@resk/core
Version:
An innovative TypeScript framework that empowers developers to build applications with a fully decorator-based architecture for efficient resource management. By combining the power of decorators with a resource-oriented design, DecorRes enhances code cla
1 lines • 1.18 kB
JavaScript
;function r(t,i=false){if(!t||typeof t!="string")return "";let e=t.trim();if(e==="")return "";let n=e.split("/").pop()||e.split("\\").pop()||e,a=n.lastIndexOf(".");if(a<=0||a===n.length-1)return "";let s=n.substring(a);return i?s.substring(1):s}function o(t){return !!(t&&typeof t=="string")}var g=/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)$/i,f=function(i){return o(i)&&!i.includes("data:image/x-icon")&&!!i.match(g)},x=t=>{if(!o(t))return false;t=t.trim(),t.startsWith("blob:http")&&(t=t.ltrim("blob:"));let i=/^data:image\/(jpeg|jpg|png|gif|bmp|webp|svg\+xml|x-icon|vnd\.microsoft\.icon|tiff|avif|heic);base64,([A-Za-z0-9+/=]+)$/,e=/^data:image\/(jpeg|jpg|png|gif|bmp|webp|svg\+xml|x-icon|vnd\.microsoft\.icon|tiff|avif|heic),([A-Za-z0-9+/=]+)$/;return i.test(t)||e.test(t)?true:f(t)||t.startsWith("data:image/")||l(t)};function l(t){let i=t.split("?")[0].split("#")[0].toLowerCase(),e=r(i,false).toLowerCase().trim();return [".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif",".avif",".heic"].includes(e)}exports.isDataUrl=f;exports.isValidImageSrc=x;