verdnatura-chat/app/lib/methods/helpers/image.ts

7 lines
314 B
TypeScript
Raw Normal View History

2022-12-19 19:06:06 +00:00
// Fast Image can't render a svg image from a uri yet, because of that we aren't test the svg within the RegEx
const regExpUrlImage = new RegExp(
'.(jpg|jpeg|png|webp|avif|gif)' + // type of the URL
'(\\?[;&a-z\\d%_.~+=-]*)?' // query string
);
2022-12-19 15:34:47 +00:00
export const isImage = (url: string) => regExpUrlImage.test(url);