@zag-js/utils 0.75.0 → 0.77.0
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.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -1
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,8 +5,9 @@ declare const last: <T>(v: T[]) => T | undefined;
|
|
|
5
5
|
declare const isEmpty: <T>(v: T[]) => boolean;
|
|
6
6
|
declare const has: <T>(v: T[], t: any) => boolean;
|
|
7
7
|
declare const add: <T>(v: T[], ...items: T[]) => T[];
|
|
8
|
-
declare const remove: <T>(v: T[],
|
|
8
|
+
declare const remove: <T>(v: T[], ...items: T[]) => T[];
|
|
9
9
|
declare const removeAt: <T>(v: T[], i: number) => T[];
|
|
10
|
+
declare const insertAt: <T>(v: T[], i: number, ...items: T[]) => T[];
|
|
10
11
|
declare const uniq: <T>(v: T[]) => T[];
|
|
11
12
|
declare const addOrRemove: <T>(v: T[], item: T) => T[];
|
|
12
13
|
declare function clear<T>(v: T[]): T[];
|
|
@@ -58,4 +59,4 @@ declare function warn(c: boolean, m: string): void;
|
|
|
58
59
|
declare function invariant(m: string): void;
|
|
59
60
|
declare function invariant(c: boolean, m: string): void;
|
|
60
61
|
|
|
61
|
-
export { type IndexOptions, type MaybeFunction, type Nullable, add, addOrRemove, callAll, cast, chunk, clear, compact, createSplitProps, first, fromLength, has, hasProp, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, json, last, match, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, runIfFn, splitProps, toArray, tryCatch, uniq, uuid, warn };
|
|
62
|
+
export { type IndexOptions, type MaybeFunction, type Nullable, add, addOrRemove, callAll, cast, chunk, clear, compact, createSplitProps, first, fromLength, has, hasProp, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, json, last, match, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, runIfFn, splitProps, toArray, tryCatch, uniq, uuid, warn };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ declare const last: <T>(v: T[]) => T | undefined;
|
|
|
5
5
|
declare const isEmpty: <T>(v: T[]) => boolean;
|
|
6
6
|
declare const has: <T>(v: T[], t: any) => boolean;
|
|
7
7
|
declare const add: <T>(v: T[], ...items: T[]) => T[];
|
|
8
|
-
declare const remove: <T>(v: T[],
|
|
8
|
+
declare const remove: <T>(v: T[], ...items: T[]) => T[];
|
|
9
9
|
declare const removeAt: <T>(v: T[], i: number) => T[];
|
|
10
|
+
declare const insertAt: <T>(v: T[], i: number, ...items: T[]) => T[];
|
|
10
11
|
declare const uniq: <T>(v: T[]) => T[];
|
|
11
12
|
declare const addOrRemove: <T>(v: T[], item: T) => T[];
|
|
12
13
|
declare function clear<T>(v: T[]): T[];
|
|
@@ -58,4 +59,4 @@ declare function warn(c: boolean, m: string): void;
|
|
|
58
59
|
declare function invariant(m: string): void;
|
|
59
60
|
declare function invariant(c: boolean, m: string): void;
|
|
60
61
|
|
|
61
|
-
export { type IndexOptions, type MaybeFunction, type Nullable, add, addOrRemove, callAll, cast, chunk, clear, compact, createSplitProps, first, fromLength, has, hasProp, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, json, last, match, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, runIfFn, splitProps, toArray, tryCatch, uniq, uuid, warn };
|
|
62
|
+
export { type IndexOptions, type MaybeFunction, type Nullable, add, addOrRemove, callAll, cast, chunk, clear, compact, createSplitProps, first, fromLength, has, hasProp, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, json, last, match, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, runIfFn, splitProps, toArray, tryCatch, uniq, uuid, warn };
|
package/dist/index.js
CHANGED
|
@@ -11,8 +11,9 @@ var last = (v) => v[v.length - 1];
|
|
|
11
11
|
var isEmpty = (v) => v.length === 0;
|
|
12
12
|
var has = (v, t) => v.indexOf(t) !== -1;
|
|
13
13
|
var add = (v, ...items) => v.concat(items);
|
|
14
|
-
var remove = (v,
|
|
14
|
+
var remove = (v, ...items) => v.filter((t) => !items.includes(t));
|
|
15
15
|
var removeAt = (v, i) => v.filter((_, idx) => idx !== i);
|
|
16
|
+
var insertAt = (v, i, ...items) => [...v.slice(0, i), ...items, ...v.slice(i)];
|
|
16
17
|
var uniq = (v) => Array.from(new Set(v));
|
|
17
18
|
var addOrRemove = (v, item) => {
|
|
18
19
|
if (has(v, item)) return remove(v, item);
|
|
@@ -231,6 +232,7 @@ exports.first = first;
|
|
|
231
232
|
exports.fromLength = fromLength;
|
|
232
233
|
exports.has = has;
|
|
233
234
|
exports.hasProp = hasProp;
|
|
235
|
+
exports.insertAt = insertAt;
|
|
234
236
|
exports.invariant = invariant;
|
|
235
237
|
exports.isArray = isArray;
|
|
236
238
|
exports.isBoolean = isBoolean;
|
package/dist/index.mjs
CHANGED
|
@@ -9,8 +9,9 @@ var last = (v) => v[v.length - 1];
|
|
|
9
9
|
var isEmpty = (v) => v.length === 0;
|
|
10
10
|
var has = (v, t) => v.indexOf(t) !== -1;
|
|
11
11
|
var add = (v, ...items) => v.concat(items);
|
|
12
|
-
var remove = (v,
|
|
12
|
+
var remove = (v, ...items) => v.filter((t) => !items.includes(t));
|
|
13
13
|
var removeAt = (v, i) => v.filter((_, idx) => idx !== i);
|
|
14
|
+
var insertAt = (v, i, ...items) => [...v.slice(0, i), ...items, ...v.slice(i)];
|
|
14
15
|
var uniq = (v) => Array.from(new Set(v));
|
|
15
16
|
var addOrRemove = (v, item) => {
|
|
16
17
|
if (has(v, item)) return remove(v, item);
|
|
@@ -217,4 +218,4 @@ function invariant(...a) {
|
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
220
|
|
|
220
|
-
export { add, addOrRemove, callAll, cast, chunk, clear, compact, createSplitProps, first, fromLength, has, hasProp, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, json, last, match, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, runIfFn, splitProps, toArray, tryCatch, uniq, uuid, warn };
|
|
221
|
+
export { add, addOrRemove, callAll, cast, chunk, clear, compact, createSplitProps, first, fromLength, has, hasProp, insertAt, invariant, isArray, isBoolean, isDev, isEmpty, isEqual, isFunction, isNull, isNumber, isObject, isObjectLike, isPlainObject, isString, json, last, match, next, nextIndex, noop, omit, pick, prev, prevIndex, remove, removeAt, runIfFn, splitProps, toArray, tryCatch, uniq, uuid, warn };
|