Tests if an url ends with a section that contains one of: jpg|jpeg|png|gif|svg
.
Parameters:
Name | Type | Description |
---|---|---|
url | string | The url to test. |
- Since
- 1.0.0
- Source
Returns:
Whether the passed string is an image url or not.
- Type:
- boolean
Example
import { isImageUrl } from "@gravityforms/utils";
function Example() {
const url = 'https://some-url.com/hello.jpg';
if ( isImageUrl( url ) ) {
// do something
}
}