@zag-js/utils 0.0.0-dev-20221105065843 → 0.0.0-dev-20221107094817
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare const isString: (v: any) => v is string;
|
|
|
33
33
|
declare const isFunction: (v: any) => v is Function;
|
|
34
34
|
declare const hasProp: <T extends string>(obj: any, prop: T) => obj is Record<T, any>;
|
|
35
35
|
|
|
36
|
-
declare function compact<T extends Record<string, unknown
|
|
36
|
+
declare function compact<T extends Record<string, unknown> | undefined>(obj: T): T;
|
|
37
37
|
|
|
38
38
|
declare function warn(m: string): void;
|
|
39
39
|
declare function warn(c: boolean, m: string): void;
|
package/dist/index.js
CHANGED
|
@@ -145,6 +145,8 @@ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
|
145
145
|
|
|
146
146
|
// src/object.ts
|
|
147
147
|
function compact(obj) {
|
|
148
|
+
if (obj === void 0)
|
|
149
|
+
return obj;
|
|
148
150
|
return Object.fromEntries(
|
|
149
151
|
Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
|
|
150
152
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -89,6 +89,8 @@ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
|
89
89
|
|
|
90
90
|
// src/object.ts
|
|
91
91
|
function compact(obj) {
|
|
92
|
+
if (obj === void 0)
|
|
93
|
+
return obj;
|
|
92
94
|
return Object.fromEntries(
|
|
93
95
|
Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
|
|
94
96
|
);
|