@zag-js/utils 0.3.0 → 0.3.1

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 CHANGED
@@ -34,10 +34,11 @@ 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
36
  declare function compact<T extends Record<string, unknown> | undefined>(obj: T): T;
37
+ declare function json(value: any): any;
37
38
 
38
39
  declare function warn(m: string): void;
39
40
  declare function warn(c: boolean, m: string): void;
40
41
  declare function invariant(m: string): void;
41
42
  declare function invariant(c: boolean, m: string): void;
42
43
 
43
- export { IndexOptions, add, callAll, cast, chunk, clear, compact, first, fromLength, has, hasProp, invariant, isArray, isBoolean, isDev, isEmpty, isFunction, isNumber, isObject, isString, last, next, nextIndex, noop, prev, prevIndex, remove, removeAt, runIfFn, toArray, uuid, warn };
44
+ export { IndexOptions, add, callAll, cast, chunk, clear, compact, first, fromLength, has, hasProp, invariant, isArray, isBoolean, isDev, isEmpty, isFunction, isNumber, isObject, isString, json, last, next, nextIndex, noop, prev, prevIndex, remove, removeAt, runIfFn, toArray, uuid, warn };
package/dist/index.js CHANGED
@@ -39,6 +39,7 @@ __export(src_exports, {
39
39
  isNumber: () => isNumber,
40
40
  isObject: () => isObject,
41
41
  isString: () => isString,
42
+ json: () => json,
42
43
  last: () => last,
43
44
  next: () => next,
44
45
  nextIndex: () => nextIndex,
@@ -151,6 +152,9 @@ function compact(obj) {
151
152
  Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
152
153
  );
153
154
  }
155
+ function json(value) {
156
+ return JSON.parse(JSON.stringify(value));
157
+ }
154
158
 
155
159
  // src/warning.ts
156
160
  function warn(...a) {
@@ -188,6 +192,7 @@ function invariant(...a) {
188
192
  isNumber,
189
193
  isObject,
190
194
  isString,
195
+ json,
191
196
  last,
192
197
  next,
193
198
  nextIndex,
package/dist/index.mjs CHANGED
@@ -95,6 +95,9 @@ function compact(obj) {
95
95
  Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
96
96
  );
97
97
  }
98
+ function json(value) {
99
+ return JSON.parse(JSON.stringify(value));
100
+ }
98
101
 
99
102
  // src/warning.ts
100
103
  function warn(...a) {
@@ -131,6 +134,7 @@ export {
131
134
  isNumber,
132
135
  isObject,
133
136
  isString,
137
+ json,
134
138
  last,
135
139
  next,
136
140
  nextIndex,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/utils",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",