@flourish/pocket-knife
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@flourish/pocket-knife", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Flourish module with handy tools", | ||
@@ -5,0 +5,0 @@ "main": "pocket-knife.js", |
@@ -0,2 +1,7 @@ | ||
function isUndefined(string) { | ||
return string === undefined || string === null; | ||
} | ||
function isUrl(string) { | ||
if (isUndefined(string)) return null; | ||
return string.match(/^https?:\/\//i); | ||
@@ -6,5 +11,6 @@ } | ||
function isImage(string) { | ||
return string.match(/^https?:\/\/.+\.(jpg|jpeg|svg|png|gif)$/i); | ||
if (isUndefined(string)) return null; | ||
return string.match(/^https?:\/\/.+\.(jpg|jpeg|svg|png|gif|webp)$/i); | ||
} | ||
export { isUrl, isImage } |
34
2272
5