New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@domql/utils

Package Overview
Dependencies
Maintainers
0
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@domql/utils - npm Package Compare versions

Comparing version

to
2.5.200

9

dist/cjs/array.js

@@ -51,4 +51,3 @@ "use strict";

const removeFromArray = (arr, index) => {
if ((0, import_types.isString)(index))
index = parseInt(index);
if ((0, import_types.isString)(index)) index = parseInt(index);
if ((0, import_types.isNumber)(index)) {

@@ -86,4 +85,3 @@ if (index < 0 || index >= arr.length || isNaN(index)) {

const cutArrayAfterValue = (arr, value) => {
if (!(0, import_types.isArray)(arr))
return;
if (!(0, import_types.isArray)(arr)) return;
const index = arr.indexOf(value);

@@ -147,5 +145,4 @@ if (index !== -1) {

const checkIfStringIsInArray = (string, arr) => {
if (!string)
return;
if (!string) return;
return arr.filter((v) => string.includes(v)).length;
};

@@ -44,4 +44,3 @@ "use strict";

const isFirstKeyString = (0, import_types.isString)(key);
if (!isFirstKeyString)
return;
if (!isFirstKeyString) return;
const firstCharKey = key.slice(0, 1);

@@ -52,4 +51,3 @@ return /^[A-Z]*$/.test(firstCharKey);

const isFirstKeyString = (0, import_types.isString)(key);
if (!isFirstKeyString)
return;
if (!isFirstKeyString) return;
const firstCharKey = key.slice(0, 1);

@@ -59,4 +57,3 @@ return /^[a-z]*$/.test(firstCharKey);

const addAdditionalExtend = (newExtend, element) => {
if (!newExtend)
return element;
if (!newExtend) return element;
const { extend: elementExtend } = element;

@@ -86,4 +83,3 @@ const originalArray = (0, import_types.isArray)(elementExtend) ? elementExtend : [elementExtend];

const logErr = (_a = parent || element) == null ? void 0 : _a.error;
if (logErr)
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
if (logErr) logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
}

@@ -101,4 +97,3 @@ return !hasComponentAttrs || childProps || extendProps || children || childExtends;

const isExtendKeyComponent = context && context.components[extendFromKey];
if (element === isExtendKeyComponent)
return element;
if (element === isExtendKeyComponent) return element;
else if (isSugar) {

@@ -126,4 +121,3 @@ const newElem = addAdditionalExtend(element.extends, {

}
if (childExtends)
newElem.childExtend = childExtends;
if (childExtends) newElem.childExtend = childExtends;
return newElem;

@@ -151,4 +145,3 @@ } else if (!extend || extend === true) {

const childElems = getCapitalCaseKeys(element.props);
if (!childElems.length)
return element;
if (!childElems.length) return element;
for (const i in childElems) {

@@ -162,12 +155,8 @@ const childKey = childElems[i];

};
if (newChild == null ? void 0 : newChild.ignoreExtend)
continue;
if (newChild === null)
assignChild(null);
else if (!childElem)
assignChild((0, import_object.deepClone)(newChild));
if (newChild == null ? void 0 : newChild.ignoreExtend) continue;
if (newChild === null) assignChild(null);
else if (!childElem) assignChild((0, import_object.deepClone)(newChild));
else {
const isSugarChildElem = checkIfSugar(childElem, parent, key);
if (isSugarChildElem)
continue;
if (isSugarChildElem) continue;
assignChild({

@@ -185,4 +174,3 @@ extend: element[childKey],

const { context } = element;
if (!context || !context.components)
return;
if (!context || !context.components) return;
const { components } = context;

@@ -193,4 +181,3 @@ const { extend } = element;

const componentExists = components[execExtend] || components["smbls." + execExtend];
if (componentExists)
element.extend = componentExists;
if (componentExists) element.extend = componentExists;
else {

@@ -206,4 +193,3 @@ if ((ENV === "test" || ENV === "development") && options.verbose) {

const isVariant = (param) => {
if (!(0, import_types.isString)(param))
return;
if (!(0, import_types.isString)(param)) return;
const firstCharKey = param.slice(0, 1);

@@ -214,4 +200,3 @@ return firstCharKey === ".";

const { props } = element;
if ((0, import_types.isObject)(props) && (0, import_types.isString)(props.variant))
return true;
if ((0, import_types.isObject)(props) && (0, import_types.isString)(props.variant)) return true;
};

@@ -225,4 +210,3 @@ const getChildrenComponentsByKey = (key, el) => {

const foundInArray = (0, import_types.isArray)(el.extend) && el.extend.filter((v) => v === key).length;
if (foundString || foundInArray)
return el;
if (foundString || foundInArray) return el;
}

@@ -232,4 +216,3 @@ if (el.parent && el.parent.childExtend) {

const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
if (foundString || foundInArray)
return el;
if (foundString || foundInArray) return el;
}

@@ -266,7 +249,5 @@ };

ref.contentElementKey = contentElementKey || "content";
} else
ref.contentElementKey = "content";
if (contentElementKey !== "content")
opts.contentElementKey = "content";
} else ref.contentElementKey = "content";
if (contentElementKey !== "content") opts.contentElementKey = "content";
return ref.contentElementKey;
};

@@ -33,4 +33,3 @@ "use strict";

const setCookie = (cname, cvalue, exdays = 365) => {
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie))
return;
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) return;
const d = /* @__PURE__ */ new Date();

@@ -42,4 +41,3 @@ d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);

const getCookie = (cname) => {
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie))
return;
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) return;
const name = `${cname}=`;

@@ -50,6 +48,4 @@ const decodedCookie = decodeURIComponent(import_globals.document.cookie);

let c = ca[i];
while (c.charAt(0) === " ")
c = c.substring(1);
if (c.indexOf(name) === 0)
return c.substring(name.length, c.length);
while (c.charAt(0) === " ") c = c.substring(1);
if (c.indexOf(name) === 0) return c.substring(name.length, c.length);
}

@@ -59,4 +55,3 @@ return "";

const removeCookie = (cname) => {
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie))
return;
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) return;
import_globals.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";

@@ -63,0 +58,0 @@ };

@@ -35,4 +35,3 @@ "use strict";

timeout = null;
if (!immediate)
func.apply(context, args);
if (!immediate) func.apply(context, args);
};

@@ -42,4 +41,3 @@ const callNow = immediate && !timeout;

timeout = setTimeout(later, wait);
if (callNow)
func.apply(context, args);
if (callNow) func.apply(context, args);
};

@@ -46,0 +44,0 @@ }

@@ -16,16 +16,16 @@ "use strict";

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var utils_exports = {};
module.exports = __toCommonJS(utils_exports);
__reExport(utils_exports, require("./key.js"), module.exports);
__reExport(utils_exports, require("./env.js"), module.exports);
__reExport(utils_exports, require("./types.js"), module.exports);
__reExport(utils_exports, require("./object.js"), module.exports);
__reExport(utils_exports, require("./function.js"), module.exports);
__reExport(utils_exports, require("./array.js"), module.exports);
__reExport(utils_exports, require("./node.js"), module.exports);
__reExport(utils_exports, require("./log.js"), module.exports);
__reExport(utils_exports, require("./string.js"), module.exports);
__reExport(utils_exports, require("./globals.js"), module.exports);
__reExport(utils_exports, require("./cookie.js"), module.exports);
__reExport(utils_exports, require("./tags.js"), module.exports);
__reExport(utils_exports, require("./component.js"), module.exports);
var index_exports = {};
module.exports = __toCommonJS(index_exports);
__reExport(index_exports, require("./key.js"), module.exports);
__reExport(index_exports, require("./env.js"), module.exports);
__reExport(index_exports, require("./types.js"), module.exports);
__reExport(index_exports, require("./object.js"), module.exports);
__reExport(index_exports, require("./function.js"), module.exports);
__reExport(index_exports, require("./array.js"), module.exports);
__reExport(index_exports, require("./node.js"), module.exports);
__reExport(index_exports, require("./log.js"), module.exports);
__reExport(index_exports, require("./string.js"), module.exports);
__reExport(index_exports, require("./globals.js"), module.exports);
__reExport(index_exports, require("./cookie.js"), module.exports);
__reExport(index_exports, require("./tags.js"), module.exports);
__reExport(index_exports, require("./component.js"), module.exports);

@@ -25,3 +25,3 @@ "use strict";

module.exports = __toCommonJS(key_exports);
const generateKey = function() {
const generateKey = /* @__PURE__ */ function() {
let index = 0;

@@ -28,0 +28,0 @@ function newId() {

@@ -26,4 +26,3 @@ "use strict";

const logIf = (bool, ...arg) => {
if (bool)
arg.map((v) => console.log(v));
if (bool) arg.map((v) => console.log(v));
};

@@ -30,0 +29,0 @@ const logGroupIf = (bool, key, ...arg) => {

@@ -86,4 +86,3 @@ "use strict";

const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
continue;
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
const elementProp = element[e];

@@ -100,4 +99,3 @@ const objProp = obj[e];

const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
continue;
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
const elementProp = element[e];

@@ -117,4 +115,3 @@ const extendProp = extend[e];

const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__"))
continue;
if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__")) continue;
o[prop] = obj[prop];

@@ -145,9 +142,6 @@ }

for (const key in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, key))
continue;
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
continue;
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
const value = obj[key];
if (cleanUndefined && (0, import_types.isUndefined)(value) || cleanNull && (0, import_types.isNull)(value))
continue;
if (cleanUndefined && (0, import_types.isUndefined)(value) || cleanNull && (0, import_types.isNull)(value)) continue;
if ((0, import_node.isDOMNode)(value)) {

@@ -283,4 +277,3 @@ clone2[key] = value;

const objProp = obj[prop];
if ((0, import_types.isFunction)(objProp))
continue;
if ((0, import_types.isFunction)(objProp)) continue;
else if ((0, import_types.isObject)(objProp)) {

@@ -292,4 +285,3 @@ detached[prop] = {};

objProp.forEach((v, i) => {
if ((0, import_types.isFunction)(v))
return;
if ((0, import_types.isFunction)(v)) return;
if ((0, import_types.isObject)(v)) {

@@ -309,11 +301,7 @@ detached[prop][i] = {};

const hasFunction = (str) => {
if (!str)
return false;
if (!str) return false;
const trimmed = str.trim().replace(/\n\s*/g, " ").trim();
if (trimmed === "")
return false;
if (trimmed === "{}")
return false;
if (trimmed === "[]")
return false;
if (trimmed === "") return false;
if (trimmed === "{}") return false;
if (trimmed === "[]") return false;
const patterns = [

@@ -336,4 +324,3 @@ /^\(\s*\{[^}]*\}\s*\)\s*=>/,

const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
if (!hasOwnProperty2)
continue;
if (!hasOwnProperty2) continue;
const objProp = obj[prop];

@@ -346,4 +333,3 @@ if ((0, import_types.isString)(objProp)) {

} catch (e) {
if (e)
destringified[prop] = objProp;
if (e) destringified[prop] = objProp;
}

@@ -362,4 +348,3 @@ } else {

} catch (e) {
if (e)
destringified[prop].push(arrProp);
if (e) destringified[prop].push(arrProp);
}

@@ -387,4 +372,3 @@ } else {

} catch (e) {
if (opts.verbose)
console.warn(e);
if (opts.verbose) console.warn(e);
}

@@ -394,4 +378,3 @@ };

for (const e in objToDiff) {
if (e === "ref")
continue;
if (e === "ref") continue;
const originalProp = original[e];

@@ -439,6 +422,4 @@ const objToDiffProp = objToDiff[e];

const deepDiff = (lhs, rhs) => {
if (lhs === rhs)
return {};
if (!(0, import_types.isObjectLike)(lhs) || !(0, import_types.isObjectLike)(rhs))
return rhs;
if (lhs === rhs) return {};
if (!(0, import_types.isObjectLike)(lhs) || !(0, import_types.isObjectLike)(rhs)) return rhs;
const deletedValues = Object.keys(lhs).reduce((acc, key) => {

@@ -451,4 +432,3 @@ if (!hasOwnProperty(rhs, key)) {

if ((0, import_types.isDate)(lhs) || (0, import_types.isDate)(rhs)) {
if (lhs.valueOf() === rhs.valueOf())
return {};
if (lhs.valueOf() === rhs.valueOf()) return {};
return rhs;

@@ -475,4 +455,3 @@ }

for (const e in params) {
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
continue;
if (excl.includes(e) || !allowUnderscore && e.startsWith("__")) continue;
const elementProp = element[e];

@@ -494,4 +473,3 @@ const paramsProp = params[e];

for (const e in params) {
if (excludeFrom.includes(e) || e.startsWith("__"))
continue;
if (excludeFrom.includes(e) || e.startsWith("__")) continue;
obj[e] = params[e];

@@ -507,10 +485,7 @@ }

}
if (visited.has(obj))
return visited.get(obj);
if (visited.has(obj)) return visited.get(obj);
visited.set(obj, obj);
for (const e in params) {
if (!Object.hasOwnProperty.call(params, e))
continue;
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
continue;
if (!Object.hasOwnProperty.call(params, e)) continue;
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
const objProp = obj[e];

@@ -529,4 +504,3 @@ const paramsProp = params[e];

const mergeIfExisted = (a, b) => {
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
return deepMerge(a, b);
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b)) return deepMerge(a, b);
return a || b;

@@ -538,4 +512,3 @@ };

const extendOfExtend = objectized[prop];
if (extendOfExtend)
flattenRecursive(extendOfExtend, prop, stack);
if (extendOfExtend) flattenRecursive(extendOfExtend, prop, stack);
delete objectized[prop];

@@ -571,8 +544,5 @@ return stack;

const deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
if (obj1 === obj2)
return true;
if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
return false;
if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
return obj1 === obj2;
if (obj1 === obj2) return true;
if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2)) return false;
if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2)) return obj1 === obj2;
const stack = [[obj1, obj2]];

@@ -582,17 +552,13 @@ const visited = /* @__PURE__ */ new WeakSet();

const [current1, current2] = stack.pop();
if (visited.has(current1))
continue;
if (visited.has(current1)) continue;
visited.add(current1);
const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
if (keys1.length !== keys2.length)
return false;
if (keys1.length !== keys2.length) return false;
for (const key of keys1) {
if (!Object.prototype.hasOwnProperty.call(current2, key))
return false;
if (!Object.prototype.hasOwnProperty.call(current2, key)) return false;
const value1 = current1[key];
const value2 = current2[key];
if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
if (value1 !== value2)
return false;
if (value1 !== value2) return false;
} else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {

@@ -610,4 +576,3 @@ if (value1 !== value2) {

const removeFromObject = (obj, props) => {
if (props === void 0 || props === null)
return obj;
if (props === void 0 || props === null) return obj;
if ((0, import_types.is)(props)("string", "number")) {

@@ -643,3 +608,3 @@ delete obj[props];

}
if (index === arr.length - 1 && lastValue) {
if (index === arr.length - 1 && lastValue !== void 0) {
obj[value] = lastValue;

@@ -646,0 +611,0 @@ }

@@ -50,4 +50,3 @@ "use strict";

function replaceLiteralsWithObjectFields(str, options = {}, forcedState) {
if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{"))
return str;
if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{")) return str;
const reg = brackRegex[options.bracketsLength || 2];

@@ -54,0 +53,0 @@ const obj = forcedState || (this == null ? void 0 : this.state) || {};

@@ -39,4 +39,3 @@ "use strict";

const isObject = (arg) => {
if (arg === null)
return false;
if (arg === null) return false;
return typeof arg === "object" && arg.constructor === Object;

@@ -52,4 +51,3 @@ };

const isObjectLike = (arg) => {
if (arg === null)
return false;
if (arg === null) return false;
return typeof arg === "object";

@@ -56,0 +54,0 @@ };

@@ -12,4 +12,3 @@ import { deepClone, deepMerge } from "./object.js";

const removeFromArray = (arr, index) => {
if (isString(index))
index = parseInt(index);
if (isString(index)) index = parseInt(index);
if (isNumber(index)) {

@@ -47,4 +46,3 @@ if (index < 0 || index >= arr.length || isNaN(index)) {

const cutArrayAfterValue = (arr, value) => {
if (!isArray(arr))
return;
if (!isArray(arr)) return;
const index = arr.indexOf(value);

@@ -108,4 +106,3 @@ if (index !== -1) {

const checkIfStringIsInArray = (string, arr) => {
if (!string)
return;
if (!string) return;
return arr.filter((v) => string.includes(v)).length;

@@ -112,0 +109,0 @@ };

@@ -26,4 +26,3 @@ var __defProp = Object.defineProperty;

const isFirstKeyString = isString(key);
if (!isFirstKeyString)
return;
if (!isFirstKeyString) return;
const firstCharKey = key.slice(0, 1);

@@ -34,4 +33,3 @@ return /^[A-Z]*$/.test(firstCharKey);

const isFirstKeyString = isString(key);
if (!isFirstKeyString)
return;
if (!isFirstKeyString) return;
const firstCharKey = key.slice(0, 1);

@@ -41,4 +39,3 @@ return /^[a-z]*$/.test(firstCharKey);

const addAdditionalExtend = (newExtend, element) => {
if (!newExtend)
return element;
if (!newExtend) return element;
const { extend: elementExtend } = element;

@@ -68,4 +65,3 @@ const originalArray = isArray(elementExtend) ? elementExtend : [elementExtend];

const logErr = (_a = parent || element) == null ? void 0 : _a.error;
if (logErr)
logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
if (logErr) logErr.call(element, "Sugar component includes params for builtin components", { verbose: true });
}

@@ -83,4 +79,3 @@ return !hasComponentAttrs || childProps || extendProps || children || childExtends;

const isExtendKeyComponent = context && context.components[extendFromKey];
if (element === isExtendKeyComponent)
return element;
if (element === isExtendKeyComponent) return element;
else if (isSugar) {

@@ -108,4 +103,3 @@ const newElem = addAdditionalExtend(element.extends, {

}
if (childExtends)
newElem.childExtend = childExtends;
if (childExtends) newElem.childExtend = childExtends;
return newElem;

@@ -132,4 +126,3 @@ } else if (!extend || extend === true) {

const childElems = getCapitalCaseKeys(element.props);
if (!childElems.length)
return element;
if (!childElems.length) return element;
for (const i in childElems) {

@@ -143,12 +136,8 @@ const childKey = childElems[i];

};
if (newChild == null ? void 0 : newChild.ignoreExtend)
continue;
if (newChild === null)
assignChild(null);
else if (!childElem)
assignChild(deepClone(newChild));
if (newChild == null ? void 0 : newChild.ignoreExtend) continue;
if (newChild === null) assignChild(null);
else if (!childElem) assignChild(deepClone(newChild));
else {
const isSugarChildElem = checkIfSugar(childElem, parent, key);
if (isSugarChildElem)
continue;
if (isSugarChildElem) continue;
assignChild({

@@ -166,4 +155,3 @@ extend: element[childKey],

const { context } = element;
if (!context || !context.components)
return;
if (!context || !context.components) return;
const { components } = context;

@@ -174,4 +162,3 @@ const { extend } = element;

const componentExists = components[execExtend] || components["smbls." + execExtend];
if (componentExists)
element.extend = componentExists;
if (componentExists) element.extend = componentExists;
else {

@@ -187,4 +174,3 @@ if ((ENV === "test" || ENV === "development") && options.verbose) {

const isVariant = (param) => {
if (!isString(param))
return;
if (!isString(param)) return;
const firstCharKey = param.slice(0, 1);

@@ -195,4 +181,3 @@ return firstCharKey === ".";

const { props } = element;
if (isObject(props) && isString(props.variant))
return true;
if (isObject(props) && isString(props.variant)) return true;
};

@@ -206,4 +191,3 @@ const getChildrenComponentsByKey = (key, el) => {

const foundInArray = isArray(el.extend) && el.extend.filter((v) => v === key).length;
if (foundString || foundInArray)
return el;
if (foundString || foundInArray) return el;
}

@@ -213,4 +197,3 @@ if (el.parent && el.parent.childExtend) {

const foundInArray = isArray(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
if (foundString || foundInArray)
return el;
if (foundString || foundInArray) return el;
}

@@ -247,6 +230,4 @@ };

ref.contentElementKey = contentElementKey || "content";
} else
ref.contentElementKey = "content";
if (contentElementKey !== "content")
opts.contentElementKey = "content";
} else ref.contentElementKey = "content";
if (contentElementKey !== "content") opts.contentElementKey = "content";
return ref.contentElementKey;

@@ -253,0 +234,0 @@ };

@@ -5,4 +5,3 @@ import { isUndefined } from "./types.js";

const setCookie = (cname, cvalue, exdays = 365) => {
if (isUndefined(document) || isUndefined(document.cookie))
return;
if (isUndefined(document) || isUndefined(document.cookie)) return;
const d = /* @__PURE__ */ new Date();

@@ -14,4 +13,3 @@ d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);

const getCookie = (cname) => {
if (isUndefined(document) || isUndefined(document.cookie))
return;
if (isUndefined(document) || isUndefined(document.cookie)) return;
const name = `${cname}=`;

@@ -22,6 +20,4 @@ const decodedCookie = decodeURIComponent(document.cookie);

let c = ca[i];
while (c.charAt(0) === " ")
c = c.substring(1);
if (c.indexOf(name) === 0)
return c.substring(name.length, c.length);
while (c.charAt(0) === " ") c = c.substring(1);
if (c.indexOf(name) === 0) return c.substring(name.length, c.length);
}

@@ -31,4 +27,3 @@ return "";

const removeCookie = (cname) => {
if (isUndefined(document) || isUndefined(document.cookie))
return;
if (isUndefined(document) || isUndefined(document.cookie)) return;
document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";

@@ -35,0 +30,0 @@ };

@@ -8,4 +8,3 @@ function debounce(func, wait, immediate) {

timeout = null;
if (!immediate)
func.apply(context, args);
if (!immediate) func.apply(context, args);
};

@@ -15,4 +14,3 @@ const callNow = immediate && !timeout;

timeout = setTimeout(later, wait);
if (callNow)
func.apply(context, args);
if (callNow) func.apply(context, args);
};

@@ -19,0 +17,0 @@ }

@@ -1,2 +0,2 @@

const generateKey = function() {
const generateKey = /* @__PURE__ */ function() {
let index = 0;

@@ -3,0 +3,0 @@ function newId() {

const logIf = (bool, ...arg) => {
if (bool)
arg.map((v) => console.log(v));
if (bool) arg.map((v) => console.log(v));
};

@@ -5,0 +4,0 @@ const logGroupIf = (bool, key, ...arg) => {

@@ -55,4 +55,3 @@ var __defProp = Object.defineProperty;

const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
continue;
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
const elementProp = element[e];

@@ -69,4 +68,3 @@ const objProp = obj[e];

const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
continue;
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
const elementProp = element[e];

@@ -86,4 +84,3 @@ const extendProp = extend[e];

const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__"))
continue;
if (!hasOwnProperty2 || excludeFrom.includes(prop) || prop.startsWith("__")) continue;
o[prop] = obj[prop];

@@ -114,9 +111,6 @@ }

for (const key in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, key))
continue;
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
continue;
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
const value = obj[key];
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
continue;
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
if (isDOMNode(value)) {

@@ -251,4 +245,3 @@ clone2[key] = value;

const objProp = obj[prop];
if (isFunction(objProp))
continue;
if (isFunction(objProp)) continue;
else if (isObject(objProp)) {

@@ -260,4 +253,3 @@ detached[prop] = {};

objProp.forEach((v, i) => {
if (isFunction(v))
return;
if (isFunction(v)) return;
if (isObject(v)) {

@@ -277,11 +269,7 @@ detached[prop][i] = {};

const hasFunction = (str) => {
if (!str)
return false;
if (!str) return false;
const trimmed = str.trim().replace(/\n\s*/g, " ").trim();
if (trimmed === "")
return false;
if (trimmed === "{}")
return false;
if (trimmed === "[]")
return false;
if (trimmed === "") return false;
if (trimmed === "{}") return false;
if (trimmed === "[]") return false;
const patterns = [

@@ -304,4 +292,3 @@ /^\(\s*\{[^}]*\}\s*\)\s*=>/,

const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, prop);
if (!hasOwnProperty2)
continue;
if (!hasOwnProperty2) continue;
const objProp = obj[prop];

@@ -314,4 +301,3 @@ if (isString(objProp)) {

} catch (e) {
if (e)
destringified[prop] = objProp;
if (e) destringified[prop] = objProp;
}

@@ -330,4 +316,3 @@ } else {

} catch (e) {
if (e)
destringified[prop].push(arrProp);
if (e) destringified[prop].push(arrProp);
}

@@ -355,4 +340,3 @@ } else {

} catch (e) {
if (opts.verbose)
console.warn(e);
if (opts.verbose) console.warn(e);
}

@@ -362,4 +346,3 @@ };

for (const e in objToDiff) {
if (e === "ref")
continue;
if (e === "ref") continue;
const originalProp = original[e];

@@ -407,6 +390,4 @@ const objToDiffProp = objToDiff[e];

const deepDiff = (lhs, rhs) => {
if (lhs === rhs)
return {};
if (!isObjectLike(lhs) || !isObjectLike(rhs))
return rhs;
if (lhs === rhs) return {};
if (!isObjectLike(lhs) || !isObjectLike(rhs)) return rhs;
const deletedValues = Object.keys(lhs).reduce((acc, key) => {

@@ -419,4 +400,3 @@ if (!hasOwnProperty(rhs, key)) {

if (isDate(lhs) || isDate(rhs)) {
if (lhs.valueOf() === rhs.valueOf())
return {};
if (lhs.valueOf() === rhs.valueOf()) return {};
return rhs;

@@ -443,4 +423,3 @@ }

for (const e in params) {
if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
continue;
if (excl.includes(e) || !allowUnderscore && e.startsWith("__")) continue;
const elementProp = element[e];

@@ -462,4 +441,3 @@ const paramsProp = params[e];

for (const e in params) {
if (excludeFrom.includes(e) || e.startsWith("__"))
continue;
if (excludeFrom.includes(e) || e.startsWith("__")) continue;
obj[e] = params[e];

@@ -475,10 +453,7 @@ }

}
if (visited.has(obj))
return visited.get(obj);
if (visited.has(obj)) return visited.get(obj);
visited.set(obj, obj);
for (const e in params) {
if (!Object.hasOwnProperty.call(params, e))
continue;
if (excl.includes(e) || forcedExclude && e.startsWith("__"))
continue;
if (!Object.hasOwnProperty.call(params, e)) continue;
if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
const objProp = obj[e];

@@ -497,4 +472,3 @@ const paramsProp = params[e];

const mergeIfExisted = (a, b) => {
if (isObjectLike(a) && isObjectLike(b))
return deepMerge(a, b);
if (isObjectLike(a) && isObjectLike(b)) return deepMerge(a, b);
return a || b;

@@ -506,4 +480,3 @@ };

const extendOfExtend = objectized[prop];
if (extendOfExtend)
flattenRecursive(extendOfExtend, prop, stack);
if (extendOfExtend) flattenRecursive(extendOfExtend, prop, stack);
delete objectized[prop];

@@ -539,8 +512,5 @@ return stack;

const deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
if (obj1 === obj2)
return true;
if (!isObjectLike(obj1) || !isObjectLike(obj2))
return false;
if (isDOMNode(obj1) || isDOMNode(obj2))
return obj1 === obj2;
if (obj1 === obj2) return true;
if (!isObjectLike(obj1) || !isObjectLike(obj2)) return false;
if (isDOMNode(obj1) || isDOMNode(obj2)) return obj1 === obj2;
const stack = [[obj1, obj2]];

@@ -550,17 +520,13 @@ const visited = /* @__PURE__ */ new WeakSet();

const [current1, current2] = stack.pop();
if (visited.has(current1))
continue;
if (visited.has(current1)) continue;
visited.add(current1);
const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
if (keys1.length !== keys2.length)
return false;
if (keys1.length !== keys2.length) return false;
for (const key of keys1) {
if (!Object.prototype.hasOwnProperty.call(current2, key))
return false;
if (!Object.prototype.hasOwnProperty.call(current2, key)) return false;
const value1 = current1[key];
const value2 = current2[key];
if (isDOMNode(value1) || isDOMNode(value2)) {
if (value1 !== value2)
return false;
if (value1 !== value2) return false;
} else if (isObjectLike(value1) && isObjectLike(value2)) {

@@ -578,4 +544,3 @@ if (value1 !== value2) {

const removeFromObject = (obj, props) => {
if (props === void 0 || props === null)
return obj;
if (props === void 0 || props === null) return obj;
if (is(props)("string", "number")) {

@@ -611,3 +576,3 @@ delete obj[props];

}
if (index === arr.length - 1 && lastValue) {
if (index === arr.length - 1 && lastValue !== void 0) {
obj[value] = lastValue;

@@ -614,0 +579,0 @@ }

@@ -18,4 +18,3 @@ const stringIncludesAny = (str, characters) => {

function replaceLiteralsWithObjectFields(str, options = {}, forcedState) {
if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{"))
return str;
if (!str.includes(options.bracketsLength === 3 ? "{{{" : "{{")) return str;
const reg = brackRegex[options.bracketsLength || 2];

@@ -22,0 +21,0 @@ const obj = forcedState || (this == null ? void 0 : this.state) || {};

import { isHtmlElement, isNode } from "./node.js";
const isObject = (arg) => {
if (arg === null)
return false;
if (arg === null) return false;
return typeof arg === "object" && arg.constructor === Object;

@@ -15,4 +14,3 @@ };

const isObjectLike = (arg) => {
if (arg === null)
return false;
if (arg === null) return false;
return typeof arg === "object";

@@ -19,0 +17,0 @@ };

@@ -730,3 +730,3 @@ 'use strict'

}
if (index === arr.length - 1 && lastValue) {
if (index === arr.length - 1 && lastValue !== undefined) {
obj[value] = lastValue

@@ -733,0 +733,0 @@ }

{
"name": "@domql/utils",
"version": "2.5.187",
"version": "2.5.200",
"license": "MIT",

@@ -27,3 +27,3 @@ "type": "module",

},
"gitHead": "c150bfbbdd51b19d25c93f10334d54175cea9d1d",
"gitHead": "0afb63ec375f0526f47ff300885de393138b01e8",
"devDependencies": {

@@ -30,0 +30,0 @@ "@babel/core": "^7.12.0"