From ca7b7db66b357193f89cf5baf9f86d07d5941fc7 Mon Sep 17 00:00:00 2001 From: André Oliveira <37463445+SpecialAro@users.noreply.github.com> Date: Tue, 31 May 2022 12:07:17 +0100 Subject: Expose a new utility method 'Ferdium.isImage' for use by recipes --- src/webview/lib/RecipeWebview.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/webview/lib/RecipeWebview.ts') diff --git a/src/webview/lib/RecipeWebview.ts b/src/webview/lib/RecipeWebview.ts index e7a39579b..3afb93acb 100644 --- a/src/webview/lib/RecipeWebview.ts +++ b/src/webview/lib/RecipeWebview.ts @@ -92,6 +92,15 @@ class RecipeWebview { return this.badgeHandler.safeParseInt(text); } + /** + * Find if url contains image + * + * @param {string | number | undefined | null} text to be parsed + */ + isImage(url): boolean { + return /\.(jpg|jpeg|png|webp|avif|gif|svg)$/.test(url); + } + /** * Injects the contents of a CSS file into the current webview * -- cgit v1.2.3-54-g00ecf