@domql/utils
Advanced tools
Comparing version
'use strict' | ||
import { deepClone, deepMerge } from './object' | ||
import { isArray, isNumber, isString } from './types' | ||
import { deepClone, deepMerge } from './object.js' | ||
import { isArray, isNumber, isString } from './types.js' | ||
@@ -6,0 +6,0 @@ export const arrayContainsOtherArray = (arr1, arr2) => { |
'use strict' | ||
import { | ||
deepClone, | ||
exec, | ||
isArray, | ||
isFunction, | ||
isObject, | ||
isString, | ||
joinArrays | ||
} from '.' | ||
import { joinArrays } from './array.js' | ||
import { deepClone, exec } from './object.js' | ||
import { isArray, isFunction, isObject, isString } from './types.js' | ||
const ENV = process.env.NODE_ENV | ||
@@ -13,0 +8,0 @@ |
'use strict' | ||
import { isUndefined } from './types' | ||
import { document } from '@domql/utils' | ||
import { isUndefined } from './types.js' | ||
import { document } from './globals.js' | ||
@@ -6,0 +6,0 @@ export const isMobile = (() => typeof navigator === 'undefined' |
@@ -40,4 +40,4 @@ "use strict"; | ||
module.exports = __toCommonJS(array_exports); | ||
var import_object = require("./object"); | ||
var import_types = require("./types"); | ||
var import_object = require("./object.js"); | ||
var import_types = require("./types.js"); | ||
const arrayContainsOtherArray = (arr1, arr2) => { | ||
@@ -44,0 +44,0 @@ return arr2.every((val) => arr1.includes(val)); |
@@ -38,6 +38,8 @@ "use strict"; | ||
module.exports = __toCommonJS(component_exports); | ||
var import__ = require("."); | ||
var import_array = require("./array.js"); | ||
var import_object = require("./object.js"); | ||
var import_types = require("./types.js"); | ||
const ENV = "development"; | ||
const checkIfKeyIsComponent = (key) => { | ||
const isFirstKeyString = (0, import__.isString)(key); | ||
const isFirstKeyString = (0, import_types.isString)(key); | ||
if (!isFirstKeyString) | ||
@@ -49,3 +51,3 @@ return; | ||
const checkIfKeyIsProperty = (key) => { | ||
const isFirstKeyString = (0, import__.isString)(key); | ||
const isFirstKeyString = (0, import_types.isString)(key); | ||
if (!isFirstKeyString) | ||
@@ -60,5 +62,5 @@ return; | ||
const { extend: elementExtend } = element; | ||
const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend]; | ||
const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend]; | ||
const extend = (0, import__.joinArrays)(receivedArray, originalArray); | ||
const originalArray = (0, import_types.isArray)(elementExtend) ? elementExtend : [elementExtend]; | ||
const receivedArray = (0, import_types.isArray)(newExtend) ? newExtend : [newExtend]; | ||
const extend = (0, import_array.joinArrays)(receivedArray, originalArray); | ||
return { ...element, extend }; | ||
@@ -133,7 +135,7 @@ }; | ||
return addAdditionalExtend(extendFromKey, element); | ||
} else if ((0, import__.isFunction)(element)) { | ||
} else if ((0, import_types.isFunction)(element)) { | ||
return { | ||
extend: extendFromKey, | ||
tag, | ||
props: { ...(0, import__.exec)(element, parent) } | ||
props: { ...(0, import_object.exec)(element, parent) } | ||
}; | ||
@@ -162,3 +164,3 @@ } | ||
else if (!childElem) | ||
assignChild((0, import__.deepClone)(newChild)); | ||
assignChild((0, import_object.deepClone)(newChild)); | ||
else { | ||
@@ -184,4 +186,4 @@ const isSugarChildElem = checkIfSugar(childElem, parent, key); | ||
const { extend } = element; | ||
const execExtend = (0, import__.exec)(extend, element); | ||
if ((0, import__.isString)(execExtend)) { | ||
const execExtend = (0, import_object.exec)(extend, element); | ||
if ((0, import_types.isString)(execExtend)) { | ||
const componentExists = components[execExtend] || components["smbls." + execExtend]; | ||
@@ -200,3 +202,3 @@ if (componentExists) | ||
const isVariant = (param) => { | ||
if (!(0, import__.isString)(param)) | ||
if (!(0, import_types.isString)(param)) | ||
return; | ||
@@ -208,3 +210,3 @@ const firstCharKey = param.slice(0, 1); | ||
const { props } = element; | ||
if ((0, import__.isObject)(props) && (0, import__.isString)(props.variant)) | ||
if ((0, import_types.isObject)(props) && (0, import_types.isString)(props.variant)) | ||
return true; | ||
@@ -217,4 +219,4 @@ }; | ||
if (el.extend) { | ||
const foundString = (0, import__.isString)(el.extend) && el.extend === key; | ||
const foundInArray = (0, import__.isArray)(el.extend) && el.extend.filter((v) => v === key).length; | ||
const foundString = (0, import_types.isString)(el.extend) && el.extend === key; | ||
const foundInArray = (0, import_types.isArray)(el.extend) && el.extend.filter((v) => v === key).length; | ||
if (foundString || foundInArray) | ||
@@ -224,4 +226,4 @@ return el; | ||
if (el.parent && el.parent.childExtend) { | ||
const foundString = (0, import__.isString)(el.parent.childExtend) && el.parent.childExtend === key; | ||
const foundInArray = (0, import__.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length; | ||
const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key; | ||
const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length; | ||
if (foundString || foundInArray) | ||
@@ -228,0 +230,0 @@ return el; |
@@ -29,7 +29,7 @@ "use strict"; | ||
module.exports = __toCommonJS(cookie_exports); | ||
var import_types = require("./types"); | ||
var import_utils = require("@domql/utils"); | ||
var import_types = require("./types.js"); | ||
var import_globals = require("./globals.js"); | ||
const isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))(); | ||
const setCookie = (cname, cvalue, exdays = 365) => { | ||
if ((0, import_types.isUndefined)(import_utils.document) || (0, import_types.isUndefined)(import_utils.document.cookie)) | ||
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) | ||
return; | ||
@@ -39,9 +39,9 @@ const d = /* @__PURE__ */ new Date(); | ||
const expires = `expires=${d.toUTCString()}`; | ||
import_utils.document.cookie = `${cname}=${cvalue};${expires};path=/`; | ||
import_globals.document.cookie = `${cname}=${cvalue};${expires};path=/`; | ||
}; | ||
const getCookie = (cname) => { | ||
if ((0, import_types.isUndefined)(import_utils.document) || (0, import_types.isUndefined)(import_utils.document.cookie)) | ||
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) | ||
return; | ||
const name = `${cname}=`; | ||
const decodedCookie = decodeURIComponent(import_utils.document.cookie); | ||
const decodedCookie = decodeURIComponent(import_globals.document.cookie); | ||
const ca = decodedCookie.split(";"); | ||
@@ -58,5 +58,5 @@ for (let i = 0; i < ca.length; i++) { | ||
const removeCookie = (cname) => { | ||
if ((0, import_types.isUndefined)(import_utils.document) || (0, import_types.isUndefined)(import_utils.document.cookie)) | ||
if ((0, import_types.isUndefined)(import_globals.document) || (0, import_types.isUndefined)(import_globals.document.cookie)) | ||
return; | ||
import_utils.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | ||
import_globals.document.cookie = cname + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; | ||
}; | ||
@@ -63,0 +63,0 @@ function getLocalStorage(key) { |
@@ -26,3 +26,3 @@ "use strict"; | ||
module.exports = __toCommonJS(node_exports); | ||
var import_globals = require("./globals"); | ||
var import_globals = require("./globals.js"); | ||
const isNode = (obj) => { | ||
@@ -29,0 +29,0 @@ return (typeof Node === "object" ? obj instanceof import_globals.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false; |
@@ -37,3 +37,3 @@ "use strict"; | ||
module.exports = __toCommonJS(types_exports); | ||
var import_node = require("./node"); | ||
var import_node = require("./node.js"); | ||
const isObject = (arg) => { | ||
@@ -40,0 +40,0 @@ if (arg === null) |
@@ -1,3 +0,3 @@ | ||
import { deepClone, deepMerge } from "./object"; | ||
import { isArray, isNumber, isString } from "./types"; | ||
import { deepClone, deepMerge } from "./object.js"; | ||
import { isArray, isNumber, isString } from "./types.js"; | ||
const arrayContainsOtherArray = (arr1, arr2) => { | ||
@@ -4,0 +4,0 @@ return arr2.every((val) => arr1.includes(val)); |
@@ -20,11 +20,5 @@ var __defProp = Object.defineProperty; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
import { | ||
deepClone, | ||
exec, | ||
isArray, | ||
isFunction, | ||
isObject, | ||
isString, | ||
joinArrays | ||
} from "."; | ||
import { joinArrays } from "./array.js"; | ||
import { deepClone, exec } from "./object.js"; | ||
import { isArray, isFunction, isObject, isString } from "./types.js"; | ||
const ENV = "development"; | ||
@@ -31,0 +25,0 @@ const checkIfKeyIsComponent = (key) => { |
@@ -1,3 +0,3 @@ | ||
import { isUndefined } from "./types"; | ||
import { document } from "@domql/utils"; | ||
import { isUndefined } from "./types.js"; | ||
import { document } from "./globals.js"; | ||
const isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))(); | ||
@@ -4,0 +4,0 @@ const setCookie = (cname, cvalue, exdays = 365) => { |
@@ -1,2 +0,2 @@ | ||
import { window } from "./globals"; | ||
import { window } from "./globals.js"; | ||
const isNode = (obj) => { | ||
@@ -3,0 +3,0 @@ return (typeof Node === "object" ? obj instanceof window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false; |
@@ -1,2 +0,2 @@ | ||
import { isHtmlElement, isNode } from "./node"; | ||
import { isHtmlElement, isNode } from "./node.js"; | ||
const isObject = (arg) => { | ||
@@ -3,0 +3,0 @@ if (arg === null) |
'use strict' | ||
import { window } from './globals' | ||
import { window } from './globals.js' | ||
@@ -5,0 +5,0 @@ export const isNode = (obj) => { |
{ | ||
"name": "@domql/utils", | ||
"version": "2.5.179", | ||
"version": "2.5.184", | ||
"license": "MIT", | ||
@@ -11,3 +11,3 @@ "type": "module", | ||
"kalduna": "./dist/esm/index.js", | ||
"default": "./dist/cjs/index.js", | ||
"default": "./dist/esm/index.js", | ||
"import": "./dist/esm/index.js", | ||
@@ -29,3 +29,3 @@ "require": "./dist/cjs/index.js" | ||
}, | ||
"gitHead": "6dd81dc7848b03bd9bf564dbc82cd95af713ae21", | ||
"gitHead": "d8fb0c7460a5bed587290d7c88c0f4ca291794e8", | ||
"devDependencies": { | ||
@@ -32,0 +32,0 @@ "@babel/core": "^7.12.0" |
'use strict' | ||
import { isHtmlElement, isNode } from './node' | ||
import { isHtmlElement, isNode } from './node.js' | ||
@@ -5,0 +5,0 @@ export const isObject = arg => { |
158859
0.22%5051
-0.2%