Tests if an url ends with a section that contains a "." and inferring it to be a file. This obviously won't work with a file that has some sort of shortening/obfuscation to it.
Parameters:
Name | Type | Description |
---|---|---|
url | string | The url to test. |
- Since
- 1.0.0
- Source
Returns:
Whether the passed string is a file url or not.
- Type:
- boolean
Example
import { isFileUrl } from "@gravityforms/utils";
function Example() {
const url = 'https://some-url.com/hello.jpg';
if ( isFileUrl( url ) ) {
// do something
}
}