@yamada-ui/utils
Advanced tools
Comparing version 0.0.0-dev-20230813023829 to 0.0.0-dev-20230920110346
@@ -43,5 +43,5 @@ "use strict"; | ||
var isNull = (value) => value === null; | ||
var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !Array.isArray(value); | ||
var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !isArray(value); | ||
var isArray = (value) => Array.isArray(value); | ||
var isEmpty = (value) => !Array.isArray(value) || !value.length || value.every((v) => v == null); | ||
var isEmpty = (value) => !isArray(value) || !value.length || value.every((v) => v == null); | ||
var isFunction = (value) => typeof value === "function"; | ||
@@ -48,0 +48,0 @@ var isUnit = (value) => /[0-9].*[px|rem|em|%|vw|vh]$/.test(value); |
@@ -61,9 +61,9 @@ "use strict"; | ||
}; | ||
var filter = (cb) => (event) => { | ||
const isMouse = isMouseEvent(event); | ||
if (!isMouse || isMouse && event.button === 0) | ||
cb(event); | ||
var filter = (cb) => (ev) => { | ||
const isMouse = isMouseEvent(ev); | ||
if (!isMouse || isMouse && ev.button === 0) | ||
cb(ev); | ||
}; | ||
var wrap = (cb, filterPrimary = false) => { | ||
const listener = (event) => cb(event, { point: getEventPoint(event) }); | ||
const listener = (ev) => cb(ev, { point: getEventPoint(ev) }); | ||
const fn = filterPrimary ? filter(listener) : listener; | ||
@@ -70,0 +70,0 @@ return fn; |
@@ -148,5 +148,5 @@ "use strict"; | ||
var isNull = (value) => value === null; | ||
var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !Array.isArray(value); | ||
var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !isArray(value); | ||
var isArray = (value) => Array.isArray(value); | ||
var isEmpty = (value) => !Array.isArray(value) || !value.length || value.every((v) => v == null); | ||
var isEmpty = (value) => !isArray(value) || !value.length || value.every((v) => v == null); | ||
var isFunction = (value) => typeof value === "function"; | ||
@@ -198,12 +198,16 @@ var isUnit = (value) => /[0-9].*[px|rem|em|%|vw|vh]$/.test(value); | ||
let result = Object.assign({}, target); | ||
if (isObject(target) && isObject(source)) { | ||
for (const [sourceKey, sourceValue] of Object.entries(source)) { | ||
const targetValue = target[sourceKey]; | ||
if (overrideArray && Array.isArray(sourceValue) && Array.isArray(targetValue)) { | ||
result[sourceKey] = targetValue.concat(...sourceValue); | ||
} else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) { | ||
result[sourceKey] = merge(targetValue, sourceValue, overrideArray); | ||
} else { | ||
Object.assign(result, { [sourceKey]: sourceValue }); | ||
if (isObject(source)) { | ||
if (isObject(target)) { | ||
for (const [sourceKey, sourceValue] of Object.entries(source)) { | ||
const targetValue = target[sourceKey]; | ||
if (overrideArray && isArray(sourceValue) && isArray(targetValue)) { | ||
result[sourceKey] = targetValue.concat(...sourceValue); | ||
} else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) { | ||
result[sourceKey] = merge(targetValue, sourceValue, overrideArray); | ||
} else { | ||
Object.assign(result, { [sourceKey]: sourceValue }); | ||
} | ||
} | ||
} else { | ||
result = source; | ||
} | ||
@@ -746,9 +750,9 @@ } | ||
}; | ||
var filter = (cb) => (event) => { | ||
const isMouse = isMouseEvent(event); | ||
if (!isMouse || isMouse && event.button === 0) | ||
cb(event); | ||
var filter = (cb) => (ev) => { | ||
const isMouse = isMouseEvent(ev); | ||
if (!isMouse || isMouse && ev.button === 0) | ||
cb(ev); | ||
}; | ||
var wrap = (cb, filterPrimary = false) => { | ||
const listener = (event) => cb(event, { point: getEventPoint(event) }); | ||
const listener = (ev) => cb(ev, { point: getEventPoint(ev) }); | ||
const fn = filterPrimary ? filter(listener) : listener; | ||
@@ -755,0 +759,0 @@ return fn; |
@@ -41,3 +41,3 @@ "use strict"; | ||
// src/assertion.ts | ||
var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !Array.isArray(value); | ||
var isObject = (value) => value !== null && (typeof value === "object" || typeof value === "function") && !isArray(value); | ||
var isArray = (value) => Array.isArray(value); | ||
@@ -88,12 +88,16 @@ var isFunction = (value) => typeof value === "function"; | ||
let result = Object.assign({}, target); | ||
if (isObject(target) && isObject(source)) { | ||
for (const [sourceKey, sourceValue] of Object.entries(source)) { | ||
const targetValue = target[sourceKey]; | ||
if (overrideArray && Array.isArray(sourceValue) && Array.isArray(targetValue)) { | ||
result[sourceKey] = targetValue.concat(...sourceValue); | ||
} else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) { | ||
result[sourceKey] = merge(targetValue, sourceValue, overrideArray); | ||
} else { | ||
Object.assign(result, { [sourceKey]: sourceValue }); | ||
if (isObject(source)) { | ||
if (isObject(target)) { | ||
for (const [sourceKey, sourceValue] of Object.entries(source)) { | ||
const targetValue = target[sourceKey]; | ||
if (overrideArray && isArray(sourceValue) && isArray(targetValue)) { | ||
result[sourceKey] = targetValue.concat(...sourceValue); | ||
} else if (!isFunction(sourceValue) && isObject(sourceValue) && target.hasOwnProperty(sourceKey)) { | ||
result[sourceKey] = merge(targetValue, sourceValue, overrideArray); | ||
} else { | ||
Object.assign(result, { [sourceKey]: sourceValue }); | ||
} | ||
} | ||
} else { | ||
result = source; | ||
} | ||
@@ -100,0 +104,0 @@ } |
{ | ||
"name": "@yamada-ui/utils", | ||
"version": "0.0.0-dev-20230813023829", | ||
"version": "0.0.0-dev-20230920110346", | ||
"description": "Yamada UI utils", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136000
3534