| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/@nuxt/image/dist/runtime/utils/ |
Upload File : |
export default function imageFetch(url) {
return fetch(cleanDoubleSlashes(url));
}
export function getInt(x) {
if (typeof x === "number") {
return x;
}
if (typeof x === "string") {
return parseInt(x, 10);
}
return void 0;
}
export function getFileExtension(url = "") {
const extension = url.split(/[?#]/).shift().split("/").pop().split(".").pop();
return extension;
}
export function cleanDoubleSlashes(path = "") {
return path.replace(/(https?:\/\/)|(\/)+/g, "$1$2");
}
export function createMapper(map) {
return (key) => {
return key ? map[key] || key : map.missingValue;
};
}
export function createOperationsGenerator({formatter, keyMap, joinWith = "/", valueMap} = {}) {
if (!formatter) {
formatter = (key, value) => `${key}=${value}`;
}
if (keyMap && typeof keyMap !== "function") {
keyMap = createMapper(keyMap);
}
const map = valueMap || {};
Object.keys(map).forEach((valueKey) => {
if (typeof map[valueKey] !== "function") {
map[valueKey] = createMapper(map[valueKey]);
}
});
return (modifiers = {}) => {
const operations = Object.entries(modifiers).filter(([_, value]) => typeof value !== "undefined").map(([key, value]) => {
const mapper = map[key];
if (typeof mapper === "function") {
value = mapper(modifiers[key]);
}
key = typeof keyMap === "function" ? keyMap(key) : key;
return formatter(key, value);
});
return operations.join(joinWith);
};
}
export function renderAttributesToString(attributes = {}) {
return Object.entries(attributes).map(([key, value]) => value ? `${key}="${value}"` : "").filter(Boolean).join(" ");
}
export function renderTag(tag, attrs, contents) {
const html = `<${tag} ${renderAttributesToString(attrs)}>`;
if (!contents) {
return html;
}
return html + contents + `</${tag}>`;
}
export function generateAlt(src = "") {
return src.split(/[?#]/).shift().split("/").pop().split(".").shift();
}
export function parseSize(input = "") {
if (typeof input === "number") {
return input;
}
if (typeof input === "string") {
if (input.replace("px", "").match(/^\d+$/g)) {
return parseInt(input, 10);
}
}
}