@zag-js/core
Advanced tools
Comparing version 0.68.0 to 0.68.1
@@ -70,3 +70,4 @@ "use strict"; | ||
var isArray = (v) => Array.isArray(v); | ||
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v)); | ||
var isObjectLike = (v) => v != null && typeof v === "object"; | ||
var isObject = (v) => isObjectLike(v) && !isArray(v); | ||
var isNumber = (v) => typeof v === "number" && !Number.isNaN(v); | ||
@@ -76,6 +77,16 @@ var isString = (v) => typeof v === "string"; | ||
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop); | ||
var baseGetTag = (v) => Object.prototype.toString.call(v); | ||
var fnToString = Function.prototype.toString; | ||
var objectCtorString = fnToString.call(Object); | ||
var isPlainObject = (v) => { | ||
if (!isObjectLike(v) || baseGetTag(v) != "[object Object]") return false; | ||
const proto = Object.getPrototypeOf(v); | ||
if (proto === null) return true; | ||
const Ctor = hasProp(proto, "constructor") && proto.constructor; | ||
return typeof Ctor == "function" && Ctor instanceof Ctor && fnToString.call(Ctor) == objectCtorString; | ||
}; | ||
// ../utilities/core/src/object.ts | ||
function compact(obj) { | ||
if (!isPlainObject(obj) || obj === void 0) { | ||
if (!isPlainObject2(obj) || obj === void 0) { | ||
return obj; | ||
@@ -93,3 +104,3 @@ } | ||
} | ||
var isPlainObject = (value) => { | ||
var isPlainObject2 = (value) => { | ||
return value && typeof value === "object" && value.constructor === Object; | ||
@@ -119,3 +130,3 @@ }; | ||
for (const key in target) { | ||
if (isObject(obj[key])) { | ||
if (isPlainObject(obj[key])) { | ||
if (!source[key]) { | ||
@@ -122,0 +133,0 @@ source[key] = {}; |
{ | ||
"name": "@zag-js/core", | ||
"version": "0.68.0", | ||
"version": "0.68.1", | ||
"description": "A minimal implementation of xstate fsm for UI machines", | ||
@@ -30,7 +30,7 @@ "keywords": [ | ||
"klona": "2.0.6", | ||
"@zag-js/store": "0.68.0" | ||
"@zag-js/store": "0.68.1" | ||
}, | ||
"devDependencies": { | ||
"clean-package": "2.2.0", | ||
"@zag-js/utils": "0.68.0" | ||
"@zag-js/utils": "0.68.1" | ||
}, | ||
@@ -37,0 +37,0 @@ "clean-package": "../../clean-package.config.json", |
@@ -1,2 +0,2 @@ | ||
import { compact, isObject } from "@zag-js/utils" | ||
import { compact, isPlainObject } from "@zag-js/utils" | ||
@@ -7,3 +7,3 @@ export function deepMerge<T extends Record<string, any>>(source: T, ...objects: T[]): T { | ||
for (const key in target) { | ||
if (isObject(obj[key])) { | ||
if (isPlainObject(obj[key])) { | ||
if (!source[key]) { | ||
@@ -10,0 +10,0 @@ source[key] = {} as any |
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
301494
3582
+ Added@zag-js/store@0.68.1(transitive)
- Removed@zag-js/store@0.68.0(transitive)
Updated@zag-js/store@0.68.1