es-toolkit 1.24.0 → 1.25.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/_chunk/isPlainObject-octpoD.js +32 -0
  3. package/dist/_chunk/{isWeakSet-Bd6nry.js → isWeakSet-BuFfzX.js} +11 -8
  4. package/dist/_chunk/{toMerged-DDLv0D.js → toMerged-B5ZVux.js} +3 -6
  5. package/dist/_chunk/{unary-BZ5Ixo.js → unary-CMvKXy.js} +2 -2
  6. package/dist/_chunk/{zipWith-wpjySR.js → zipWith-Dkv3D1.js} +7 -1
  7. package/dist/array/at.mjs +1 -1
  8. package/dist/array/index.js +2 -7
  9. package/dist/browser.global.js +1 -1
  10. package/dist/browser.global.js.map +1 -1
  11. package/dist/compat/_internal/MAX_SAFE_INTEGER.mjs +3 -0
  12. package/dist/compat/array/chunk.d.mts +2 -3
  13. package/dist/compat/array/chunk.d.ts +2 -3
  14. package/dist/compat/array/chunk.mjs +3 -2
  15. package/dist/compat/array/compact.d.mts +16 -0
  16. package/dist/compat/array/compact.d.ts +16 -0
  17. package/dist/compat/array/compact.mjs +11 -0
  18. package/dist/compat/array/drop.d.mts +2 -2
  19. package/dist/compat/array/drop.d.ts +2 -2
  20. package/dist/compat/array/drop.mjs +5 -3
  21. package/dist/compat/array/dropRight.d.mts +19 -0
  22. package/dist/compat/array/dropRight.d.ts +19 -0
  23. package/dist/compat/array/dropRight.mjs +11 -0
  24. package/dist/compat/array/dropRightWhile.d.mts +8 -8
  25. package/dist/compat/array/dropRightWhile.d.ts +8 -8
  26. package/dist/compat/array/dropRightWhile.mjs +7 -0
  27. package/dist/compat/array/dropWhile.d.mts +8 -8
  28. package/dist/compat/array/dropWhile.d.ts +8 -8
  29. package/dist/compat/array/dropWhile.mjs +7 -0
  30. package/dist/compat/array/head.d.mts +18 -0
  31. package/dist/compat/array/head.d.ts +18 -0
  32. package/dist/compat/array/head.mjs +11 -0
  33. package/dist/compat/array/intersection.d.mts +20 -0
  34. package/dist/compat/array/intersection.d.ts +20 -0
  35. package/dist/compat/array/intersection.mjs +23 -0
  36. package/dist/compat/array/last.d.mts +25 -0
  37. package/dist/compat/array/last.d.ts +25 -0
  38. package/dist/compat/array/last.mjs +11 -0
  39. package/dist/compat/array/sample.d.mts +80 -0
  40. package/dist/compat/array/sample.d.ts +80 -0
  41. package/dist/compat/array/sample.mjs +14 -0
  42. package/dist/compat/array/tail.d.mts +27 -0
  43. package/dist/compat/array/tail.d.ts +27 -0
  44. package/dist/compat/array/tail.mjs +11 -0
  45. package/dist/compat/array/take.d.mts +3 -3
  46. package/dist/compat/array/take.d.ts +3 -3
  47. package/dist/compat/array/take.mjs +4 -3
  48. package/dist/compat/array/takeRight.d.mts +24 -0
  49. package/dist/compat/array/takeRight.d.ts +24 -0
  50. package/dist/compat/array/takeRight.mjs +11 -0
  51. package/dist/compat/array/uniq.d.mts +18 -0
  52. package/dist/compat/array/uniq.d.ts +18 -0
  53. package/dist/compat/array/uniq.mjs +11 -0
  54. package/dist/compat/array/without.d.mts +23 -0
  55. package/dist/compat/array/without.d.ts +23 -0
  56. package/dist/compat/array/without.mjs +11 -0
  57. package/dist/compat/index.d.mts +13 -11
  58. package/dist/compat/index.d.ts +13 -11
  59. package/dist/compat/index.js +143 -30
  60. package/dist/compat/index.mjs +13 -11
  61. package/dist/compat/object/pick.mjs +4 -0
  62. package/dist/compat/string/escape.d.mts +16 -0
  63. package/dist/compat/string/escape.d.ts +16 -0
  64. package/dist/compat/string/escape.mjs +8 -0
  65. package/dist/compat/util/toSafeInteger.d.mts +20 -0
  66. package/dist/compat/util/toSafeInteger.d.ts +20 -0
  67. package/dist/compat/util/toSafeInteger.mjs +12 -0
  68. package/dist/function/after.d.mts +2 -2
  69. package/dist/function/after.d.ts +2 -2
  70. package/dist/function/after.mjs +2 -2
  71. package/dist/function/index.js +1 -1
  72. package/dist/index.d.mts +1 -0
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.js +7 -6
  75. package/dist/index.mjs +1 -0
  76. package/dist/object/cloneDeep.mjs +3 -5
  77. package/dist/object/index.js +1 -1
  78. package/dist/predicate/index.d.mts +1 -0
  79. package/dist/predicate/index.d.ts +1 -0
  80. package/dist/predicate/index.js +3 -2
  81. package/dist/predicate/index.mjs +1 -0
  82. package/dist/predicate/isFile.d.mts +21 -0
  83. package/dist/predicate/isFile.d.ts +21 -0
  84. package/dist/predicate/isFile.mjs +10 -0
  85. package/dist/predicate/isPlainObject.d.mts +34 -5
  86. package/dist/predicate/isPlainObject.d.ts +34 -5
  87. package/dist/predicate/isPlainObject.mjs +7 -13
  88. package/package.json +1 -1
  89. package/dist/_chunk/isPlainObject-DgrsU7.js +0 -33
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Returns the last element of an array.
3
+ *
4
+ * This function takes an array and returns the last element of the array.
5
+ * If the array is empty, the function returns `undefined`.
6
+ *
7
+ * Unlike some implementations, this function is optimized for performance
8
+ * by directly accessing the last index of the array.
9
+ *
10
+ * @template T - The type of elements in the array.
11
+ * @param {ArrayLike<T> | null | undefined} arr - The array from which to get the last element.
12
+ * @returns {T | undefined} The last element of the array, or `undefined` if the array is empty.
13
+ *
14
+ * @example
15
+ * const arr = [1, 2, 3];
16
+ * const lastElement = last(arr);
17
+ * // lastElement will be 3
18
+ *
19
+ * const emptyArr: number[] = [];
20
+ * const noElement = last(emptyArr);
21
+ * // noElement will be undefined
22
+ */
23
+ declare function last<T>(array: ArrayLike<T> | null | undefined): T | undefined;
24
+
25
+ export { last };
@@ -0,0 +1,11 @@
1
+ import { last as last$1 } from '../../array/last.mjs';
2
+ import { isArrayLike } from '../predicate/isArrayLike.mjs';
3
+
4
+ function last(array) {
5
+ if (!isArrayLike(array)) {
6
+ return undefined;
7
+ }
8
+ return last$1(Array.from(array));
9
+ }
10
+
11
+ export { last };
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Returns a random element from an array.
3
+ *
4
+ * @template T
5
+ * @param {T[]} array - The array to sample from.
6
+ * @returns {T | undefined} A random element from the array, or `undefined` if the array is empty.
7
+ *
8
+ * @example
9
+ * const array = [1, 2, 3];
10
+ * const result = sample(array);
11
+ * console.log(result); // Output: 1, 2, or 3 (randomly selected)
12
+ */
13
+ declare function sample<T>(array: readonly T[]): T | undefined;
14
+ /**
15
+ * Returns a random character from a string.
16
+ *
17
+ * @param {string} str - The string to sample from.
18
+ * @returns {string | undefined} A random character from the string, or `undefined` if the string is empty.
19
+ *
20
+ * @example
21
+ * const str = "hello";
22
+ * const result = sample(str);
23
+ * console.log(result); // Output: 'h', 'e', 'l', 'l', or 'o' (randomly selected)
24
+ */
25
+ declare function sample(str: string): string | undefined;
26
+ /**
27
+ * Returns a random element from an array.
28
+ *
29
+ * @template T
30
+ * @param {ArrayLike<T>} array - The array-like object to sample from.
31
+ * @returns {T | undefined} A random element from the array, or `undefined` if the array is empty.
32
+ *
33
+ * @example
34
+ * const arrayLike: ArrayLike<string> = { 0: 'a', 1: 'b', 2: 'c', length: 3 };
35
+ * const result = sample(arrayLike);
36
+ * console.log(result); // Output: 'a', 'b', or 'c' (randomly selected)
37
+ */
38
+ declare function sample<T>(array: ArrayLike<T>): T | undefined;
39
+ /**
40
+ * Returns a random value from an object.
41
+ *
42
+ * @template T - The type of values in the object.
43
+ * @param {Record<string, T>} obj - The object to sample from.
44
+ * @returns {T | undefined} A random value from the object, or `undefined` if the object is empty.
45
+ *
46
+ * @example
47
+ * const obj = { a: 1, b: 2, c: 3 };
48
+ * const result = sample(obj);
49
+ * console.log(result); // Output: 1, 2, or 3 (randomly selected)
50
+ */
51
+ declare function sample<T>(obj: Record<string, T>): T | undefined;
52
+ /**
53
+ * Returns a random element from an array-like object or a regular object.
54
+ *
55
+ * This function takes an array-like object (such as an array or string) or a regular object,
56
+ * and returns a randomly selected element or value. If the collection is empty or invalid, it returns `undefined`.
57
+ *
58
+ * @template T - The type of elements in the collection.
59
+ * @param {ArrayLike<T> | Record<string, T>} collection - The collection to sample from.
60
+ * @returns {T | string | undefined} A random element from the collection, or `undefined` if the collection is empty or invalid.
61
+ *
62
+ * @example
63
+ * // Array example
64
+ * const array = [1, 2, 3];
65
+ * const result = sample(array);
66
+ * console.log(result); // Output: 1, 2, or 3 (randomly selected)
67
+ *
68
+ * // String example
69
+ * const str = 'abc';
70
+ * const result2 = sample(str);
71
+ * console.log(result2); // Output: 'a', 'b', or 'c' (randomly selected)
72
+ *
73
+ * // Object example
74
+ * const obj = { a: 1, b: 2, c: 3 };
75
+ * const result3 = sample(obj);
76
+ * console.log(result3); // Output: 1, 2, or 3 (randomly selected)
77
+ */
78
+ declare function sample<T>(collection: ArrayLike<T> | Record<string, T>): T | string | undefined;
79
+
80
+ export { sample };
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Returns a random element from an array.
3
+ *
4
+ * @template T
5
+ * @param {T[]} array - The array to sample from.
6
+ * @returns {T | undefined} A random element from the array, or `undefined` if the array is empty.
7
+ *
8
+ * @example
9
+ * const array = [1, 2, 3];
10
+ * const result = sample(array);
11
+ * console.log(result); // Output: 1, 2, or 3 (randomly selected)
12
+ */
13
+ declare function sample<T>(array: readonly T[]): T | undefined;
14
+ /**
15
+ * Returns a random character from a string.
16
+ *
17
+ * @param {string} str - The string to sample from.
18
+ * @returns {string | undefined} A random character from the string, or `undefined` if the string is empty.
19
+ *
20
+ * @example
21
+ * const str = "hello";
22
+ * const result = sample(str);
23
+ * console.log(result); // Output: 'h', 'e', 'l', 'l', or 'o' (randomly selected)
24
+ */
25
+ declare function sample(str: string): string | undefined;
26
+ /**
27
+ * Returns a random element from an array.
28
+ *
29
+ * @template T
30
+ * @param {ArrayLike<T>} array - The array-like object to sample from.
31
+ * @returns {T | undefined} A random element from the array, or `undefined` if the array is empty.
32
+ *
33
+ * @example
34
+ * const arrayLike: ArrayLike<string> = { 0: 'a', 1: 'b', 2: 'c', length: 3 };
35
+ * const result = sample(arrayLike);
36
+ * console.log(result); // Output: 'a', 'b', or 'c' (randomly selected)
37
+ */
38
+ declare function sample<T>(array: ArrayLike<T>): T | undefined;
39
+ /**
40
+ * Returns a random value from an object.
41
+ *
42
+ * @template T - The type of values in the object.
43
+ * @param {Record<string, T>} obj - The object to sample from.
44
+ * @returns {T | undefined} A random value from the object, or `undefined` if the object is empty.
45
+ *
46
+ * @example
47
+ * const obj = { a: 1, b: 2, c: 3 };
48
+ * const result = sample(obj);
49
+ * console.log(result); // Output: 1, 2, or 3 (randomly selected)
50
+ */
51
+ declare function sample<T>(obj: Record<string, T>): T | undefined;
52
+ /**
53
+ * Returns a random element from an array-like object or a regular object.
54
+ *
55
+ * This function takes an array-like object (such as an array or string) or a regular object,
56
+ * and returns a randomly selected element or value. If the collection is empty or invalid, it returns `undefined`.
57
+ *
58
+ * @template T - The type of elements in the collection.
59
+ * @param {ArrayLike<T> | Record<string, T>} collection - The collection to sample from.
60
+ * @returns {T | string | undefined} A random element from the collection, or `undefined` if the collection is empty or invalid.
61
+ *
62
+ * @example
63
+ * // Array example
64
+ * const array = [1, 2, 3];
65
+ * const result = sample(array);
66
+ * console.log(result); // Output: 1, 2, or 3 (randomly selected)
67
+ *
68
+ * // String example
69
+ * const str = 'abc';
70
+ * const result2 = sample(str);
71
+ * console.log(result2); // Output: 'a', 'b', or 'c' (randomly selected)
72
+ *
73
+ * // Object example
74
+ * const obj = { a: 1, b: 2, c: 3 };
75
+ * const result3 = sample(obj);
76
+ * console.log(result3); // Output: 1, 2, or 3 (randomly selected)
77
+ */
78
+ declare function sample<T>(collection: ArrayLike<T> | Record<string, T>): T | string | undefined;
79
+
80
+ export { sample };
@@ -0,0 +1,14 @@
1
+ import { sample as sample$1 } from '../../array/sample.mjs';
2
+ import { isArrayLike } from '../predicate/isArrayLike.mjs';
3
+
4
+ function sample(collection) {
5
+ if (collection == null) {
6
+ return undefined;
7
+ }
8
+ if (isArrayLike(collection)) {
9
+ return sample$1(Array.from(collection));
10
+ }
11
+ return sample$1(Object.values(collection));
12
+ }
13
+
14
+ export { sample };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Returns a new array with all elements except for the first.
3
+ *
4
+ * This function takes an array and returns a new array containing all the elements
5
+ * except for the first one. If the input array is empty or has only one element,
6
+ * an empty array is returned.
7
+ *
8
+ * @template T - The type of elements in the array.
9
+ * @param {ArrayLike<T> | null | undefined} arr - The array to get the tail of.
10
+ * @returns {T[]} A new array containing all elements of the input array except for the first one.
11
+ *
12
+ * @example
13
+ * const arr1 = [1, 2, 3];
14
+ * const result = tail(arr1);
15
+ * // result will be [2, 3]
16
+ *
17
+ * const arr2 = [1];
18
+ * const result2 = tail(arr2);
19
+ * // result2 will be []
20
+ *
21
+ * const arr3 = [];
22
+ * const result3 = tail(arr3);
23
+ * // result3 will be []
24
+ */
25
+ declare function tail<T>(arr: ArrayLike<T> | null | undefined): T[];
26
+
27
+ export { tail };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Returns a new array with all elements except for the first.
3
+ *
4
+ * This function takes an array and returns a new array containing all the elements
5
+ * except for the first one. If the input array is empty or has only one element,
6
+ * an empty array is returned.
7
+ *
8
+ * @template T - The type of elements in the array.
9
+ * @param {ArrayLike<T> | null | undefined} arr - The array to get the tail of.
10
+ * @returns {T[]} A new array containing all elements of the input array except for the first one.
11
+ *
12
+ * @example
13
+ * const arr1 = [1, 2, 3];
14
+ * const result = tail(arr1);
15
+ * // result will be [2, 3]
16
+ *
17
+ * const arr2 = [1];
18
+ * const result2 = tail(arr2);
19
+ * // result2 will be []
20
+ *
21
+ * const arr3 = [];
22
+ * const result3 = tail(arr3);
23
+ * // result3 will be []
24
+ */
25
+ declare function tail<T>(arr: ArrayLike<T> | null | undefined): T[];
26
+
27
+ export { tail };
@@ -0,0 +1,11 @@
1
+ import { tail as tail$1 } from '../../array/tail.mjs';
2
+ import { isArrayLike } from '../predicate/isArrayLike.mjs';
3
+
4
+ function tail(arr) {
5
+ if (!isArrayLike(arr)) {
6
+ return [];
7
+ }
8
+ return tail$1(Array.from(arr));
9
+ }
10
+
11
+ export { tail };
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * @template T - Type of elements in the input array.
6
6
  *
7
- * @param {T[]} arr - The array to take elements from.
8
- * @param {number} count - The number of elements to take.
7
+ * @param {ArrayLike<T> | null | undefined} arr - The array to take elements from.
8
+ * @param {number} [count=1] - The number of elements to take.
9
9
  * @returns {T[]} A new array containing the first `count` elements from `arr`.
10
10
  *
11
11
  * @example
@@ -20,6 +20,6 @@
20
20
  * // Returns [1, 2, 3]
21
21
  * take([1, 2, 3], 5);
22
22
  */
23
- declare function take<T>(arr: readonly T[], count: number): T[];
23
+ declare function take<T>(arr: ArrayLike<T> | null | undefined, count?: number): T[];
24
24
 
25
25
  export { take };
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * @template T - Type of elements in the input array.
6
6
  *
7
- * @param {T[]} arr - The array to take elements from.
8
- * @param {number} count - The number of elements to take.
7
+ * @param {ArrayLike<T> | null | undefined} arr - The array to take elements from.
8
+ * @param {number} [count=1] - The number of elements to take.
9
9
  * @returns {T[]} A new array containing the first `count` elements from `arr`.
10
10
  *
11
11
  * @example
@@ -20,6 +20,6 @@
20
20
  * // Returns [1, 2, 3]
21
21
  * take([1, 2, 3], 5);
22
22
  */
23
- declare function take<T>(arr: readonly T[], count: number): T[];
23
+ declare function take<T>(arr: ArrayLike<T> | null | undefined, count?: number): T[];
24
24
 
25
25
  export { take };
@@ -1,10 +1,11 @@
1
1
  import { take as take$1 } from '../../array/take.mjs';
2
+ import { isArrayLike } from '../predicate/isArrayLike.mjs';
2
3
 
3
- function take(arr, count) {
4
- if (count < 1) {
4
+ function take(arr, count = 1) {
5
+ if (count < 1 || !isArrayLike(arr)) {
5
6
  return [];
6
7
  }
7
- return take$1(arr, count);
8
+ return take$1(Array.from(arr), count);
8
9
  }
9
10
 
10
11
  export { take };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Returns a new array containing the last `count` elements from the input array `arr`.
3
+ * If `count` is greater than the length of `arr`, the entire array is returned.
4
+ *
5
+ * @template T - The type of elements in the array.
6
+ * @param {ArrayLike<T> | null | undefined} arr - The array to take elements from.
7
+ * @param {number} [count=1] - The number of elements to take.
8
+ * @returns {T[]} A new array containing the last `count` elements from `arr`.
9
+ *
10
+ * @example
11
+ * // Returns [4, 5]
12
+ * takeRight([1, 2, 3, 4, 5], 2);
13
+ *
14
+ * @example
15
+ * // Returns ['b', 'c']
16
+ * takeRight(['a', 'b', 'c'], 2);
17
+ *
18
+ * @example
19
+ * // Returns [1, 2, 3]
20
+ * takeRight([1, 2, 3], 5);
21
+ */
22
+ declare function takeRight<T>(arr: ArrayLike<T> | null | undefined, count?: number): T[];
23
+
24
+ export { takeRight };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Returns a new array containing the last `count` elements from the input array `arr`.
3
+ * If `count` is greater than the length of `arr`, the entire array is returned.
4
+ *
5
+ * @template T - The type of elements in the array.
6
+ * @param {ArrayLike<T> | null | undefined} arr - The array to take elements from.
7
+ * @param {number} [count=1] - The number of elements to take.
8
+ * @returns {T[]} A new array containing the last `count` elements from `arr`.
9
+ *
10
+ * @example
11
+ * // Returns [4, 5]
12
+ * takeRight([1, 2, 3, 4, 5], 2);
13
+ *
14
+ * @example
15
+ * // Returns ['b', 'c']
16
+ * takeRight(['a', 'b', 'c'], 2);
17
+ *
18
+ * @example
19
+ * // Returns [1, 2, 3]
20
+ * takeRight([1, 2, 3], 5);
21
+ */
22
+ declare function takeRight<T>(arr: ArrayLike<T> | null | undefined, count?: number): T[];
23
+
24
+ export { takeRight };
@@ -0,0 +1,11 @@
1
+ import { takeRight as takeRight$1 } from '../../array/takeRight.mjs';
2
+ import { isArrayLike } from '../predicate/isArrayLike.mjs';
3
+
4
+ function takeRight(arr, count = 1) {
5
+ if (count <= 0 || !isArrayLike(arr)) {
6
+ return [];
7
+ }
8
+ return takeRight$1(Array.from(arr), count);
9
+ }
10
+
11
+ export { takeRight };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Creates a duplicate-free version of an array.
3
+ *
4
+ * This function takes an array and returns a new array containing only the unique values
5
+ * from the original array, preserving the order of first occurrence.
6
+ *
7
+ * @template T - The type of elements in the array.
8
+ * @param {ArrayLike<T> | null | undefined} arr - The array to process.
9
+ * @returns {T[]} A new array with only unique values from the original array.
10
+ *
11
+ * @example
12
+ * const array = [1, 2, 2, 3, 4, 4, 5];
13
+ * const result = uniq(array);
14
+ * // result will be [1, 2, 3, 4, 5]
15
+ */
16
+ declare function uniq<T>(arr: ArrayLike<T> | null | undefined): T[];
17
+
18
+ export { uniq };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Creates a duplicate-free version of an array.
3
+ *
4
+ * This function takes an array and returns a new array containing only the unique values
5
+ * from the original array, preserving the order of first occurrence.
6
+ *
7
+ * @template T - The type of elements in the array.
8
+ * @param {ArrayLike<T> | null | undefined} arr - The array to process.
9
+ * @returns {T[]} A new array with only unique values from the original array.
10
+ *
11
+ * @example
12
+ * const array = [1, 2, 2, 3, 4, 4, 5];
13
+ * const result = uniq(array);
14
+ * // result will be [1, 2, 3, 4, 5]
15
+ */
16
+ declare function uniq<T>(arr: ArrayLike<T> | null | undefined): T[];
17
+
18
+ export { uniq };
@@ -0,0 +1,11 @@
1
+ import { uniq as uniq$1 } from '../../array/uniq.mjs';
2
+ import { isArrayLike } from '../predicate/isArrayLike.mjs';
3
+
4
+ function uniq(arr) {
5
+ if (!isArrayLike(arr)) {
6
+ return [];
7
+ }
8
+ return uniq$1(Array.from(arr));
9
+ }
10
+
11
+ export { uniq };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates an array that excludes all specified values.
3
+ *
4
+ * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
5
+ *
6
+ * @template T The type of elements in the array.
7
+ * @param {ArrayLike<T> | null | undefined} array - The array to filter.
8
+ * @param {...T[]} values - The values to exclude.
9
+ * @returns {T[]} A new array without the specified values.
10
+ *
11
+ * @example
12
+ * // Removes the specified values from the array
13
+ * without([1, 2, 3, 4, 5], 2, 4);
14
+ * // Returns: [1, 3, 5]
15
+ *
16
+ * @example
17
+ * // Removes specified string values from the array
18
+ * without(['a', 'b', 'c', 'a'], 'a');
19
+ * // Returns: ['b', 'c']
20
+ */
21
+ declare function without<T>(array: ArrayLike<T> | null | undefined, ...values: T[]): T[];
22
+
23
+ export { without };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates an array that excludes all specified values.
3
+ *
4
+ * It correctly excludes `NaN`, as it compares values using [SameValueZero](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-samevaluezero).
5
+ *
6
+ * @template T The type of elements in the array.
7
+ * @param {ArrayLike<T> | null | undefined} array - The array to filter.
8
+ * @param {...T[]} values - The values to exclude.
9
+ * @returns {T[]} A new array without the specified values.
10
+ *
11
+ * @example
12
+ * // Removes the specified values from the array
13
+ * without([1, 2, 3, 4, 5], 2, 4);
14
+ * // Returns: [1, 3, 5]
15
+ *
16
+ * @example
17
+ * // Removes specified string values from the array
18
+ * without(['a', 'b', 'c', 'a'], 'a');
19
+ * // Returns: ['b', 'c']
20
+ */
21
+ declare function without<T>(array: ArrayLike<T> | null | undefined, ...values: T[]): T[];
22
+
23
+ export { without };
@@ -0,0 +1,11 @@
1
+ import { without as without$1 } from '../../array/without.mjs';
2
+ import { isArrayLikeObject } from '../predicate/isArrayLikeObject.mjs';
3
+
4
+ function without(array, ...values) {
5
+ if (!isArrayLikeObject(array)) {
6
+ return [];
7
+ }
8
+ return without$1(Array.from(array), ...values);
9
+ }
10
+
11
+ export { without };
@@ -1,42 +1,32 @@
1
1
  export { at } from '../array/at.mjs';
2
- export { compact } from '../array/compact.mjs';
3
2
  export { countBy } from '../array/countBy.mjs';
4
3
  export { differenceBy } from '../array/differenceBy.mjs';
5
4
  export { differenceWith } from '../array/differenceWith.mjs';
6
- export { dropRight } from '../array/dropRight.mjs';
7
5
  export { flatMap } from '../array/flatMap.mjs';
8
6
  export { flatMapDeep } from '../array/flatMapDeep.mjs';
9
7
  export { forEachRight } from '../array/forEachRight.mjs';
10
8
  export { groupBy } from '../array/groupBy.mjs';
11
- export { head as first, head } from '../array/head.mjs';
12
9
  export { initial } from '../array/initial.mjs';
13
- export { intersection } from '../array/intersection.mjs';
14
10
  export { intersectionBy } from '../array/intersectionBy.mjs';
15
11
  export { intersectionWith } from '../array/intersectionWith.mjs';
16
12
  export { isSubset } from '../array/isSubset.mjs';
17
13
  export { keyBy } from '../array/keyBy.mjs';
18
- export { last } from '../array/last.mjs';
19
14
  export { maxBy } from '../array/maxBy.mjs';
20
15
  export { minBy } from '../array/minBy.mjs';
21
16
  export { partition } from '../array/partition.mjs';
22
17
  export { pullAt } from '../array/pullAt.mjs';
23
- export { sample } from '../array/sample.mjs';
24
18
  export { sampleSize } from '../array/sampleSize.mjs';
25
19
  export { shuffle } from '../array/shuffle.mjs';
26
- export { tail } from '../array/tail.mjs';
27
- export { takeRight } from '../array/takeRight.mjs';
28
20
  export { takeRightWhile } from '../array/takeRightWhile.mjs';
29
21
  export { takeWhile } from '../array/takeWhile.mjs';
30
22
  export { toFilled } from '../array/toFilled.mjs';
31
23
  export { union } from '../array/union.mjs';
32
24
  export { unionBy } from '../array/unionBy.mjs';
33
25
  export { unionWith } from '../array/unionWith.mjs';
34
- export { uniq } from '../array/uniq.mjs';
35
26
  export { uniqBy } from '../array/uniqBy.mjs';
36
27
  export { uniqWith } from '../array/uniqWith.mjs';
37
28
  export { unzip } from '../array/unzip.mjs';
38
29
  export { unzipWith } from '../array/unzipWith.mjs';
39
- export { without } from '../array/without.mjs';
40
30
  export { xor } from '../array/xor.mjs';
41
31
  export { xorBy } from '../array/xorBy.mjs';
42
32
  export { xorWith } from '../array/xorWith.mjs';
@@ -68,6 +58,7 @@ export { pickBy } from '../object/pickBy.mjs';
68
58
  export { toMerged } from '../object/toMerged.mjs';
69
59
  export { isBlob } from '../predicate/isBlob.mjs';
70
60
  export { isEqual } from '../predicate/isEqual.mjs';
61
+ export { isFile } from '../predicate/isFile.mjs';
71
62
  export { isFunction } from '../predicate/isFunction.mjs';
72
63
  export { isJSONArray } from '../predicate/isJSONArray.mjs';
73
64
  export { isJSONObject } from '../predicate/isJSONObject.mjs';
@@ -83,7 +74,6 @@ export { withTimeout } from '../promise/withTimeout.mjs';
83
74
  export { capitalize } from '../string/capitalize.mjs';
84
75
  export { constantCase } from '../string/constantCase.mjs';
85
76
  export { deburr } from '../string/deburr.mjs';
86
- export { escape } from '../string/escape.mjs';
87
77
  export { escapeRegExp } from '../string/escapeRegExp.mjs';
88
78
  export { lowerFirst } from '../string/lowerFirst.mjs';
89
79
  export { pascalCase } from '../string/pascalCase.mjs';
@@ -91,9 +81,11 @@ export { unescape } from '../string/unescape.mjs';
91
81
  export { upperFirst } from '../string/upperFirst.mjs';
92
82
  export { castArray } from './array/castArray.mjs';
93
83
  export { chunk } from './array/chunk.mjs';
84
+ export { compact } from './array/compact.mjs';
94
85
  export { concat } from './array/concat.mjs';
95
86
  export { difference } from './array/difference.mjs';
96
87
  export { drop } from './array/drop.mjs';
88
+ export { dropRight } from './array/dropRight.mjs';
97
89
  export { dropRightWhile } from './array/dropRightWhile.mjs';
98
90
  export { dropWhile } from './array/dropWhile.mjs';
99
91
  export { every } from './array/every.mjs';
@@ -105,15 +97,23 @@ export { findLastIndex } from './array/findLastIndex.mjs';
105
97
  export { flatten } from './array/flatten.mjs';
106
98
  export { flattenDeep } from './array/flattenDeep.mjs';
107
99
  export { flattenDepth } from './array/flattenDepth.mjs';
100
+ export { head as first, head } from './array/head.mjs';
108
101
  export { includes } from './array/includes.mjs';
109
102
  export { indexOf } from './array/indexOf.mjs';
103
+ export { intersection } from './array/intersection.mjs';
110
104
  export { join } from './array/join.mjs';
105
+ export { last } from './array/last.mjs';
111
106
  export { orderBy } from './array/orderBy.mjs';
107
+ export { sample } from './array/sample.mjs';
112
108
  export { size } from './array/size.mjs';
113
109
  export { slice } from './array/slice.mjs';
114
110
  export { some } from './array/some.mjs';
115
111
  export { sortBy } from './array/sortBy.mjs';
112
+ export { tail } from './array/tail.mjs';
116
113
  export { take } from './array/take.mjs';
114
+ export { takeRight } from './array/takeRight.mjs';
115
+ export { uniq } from './array/uniq.mjs';
116
+ export { without } from './array/without.mjs';
117
117
  export { zipObjectDeep } from './array/zipObjectDeep.mjs';
118
118
  export { ary } from './function/ary.mjs';
119
119
  export { attempt } from './function/attempt.mjs';
@@ -189,6 +189,7 @@ export { matches } from './predicate/matches.mjs';
189
189
  export { matchesProperty } from './predicate/matchesProperty.mjs';
190
190
  export { camelCase } from './string/camelCase.mjs';
191
191
  export { endsWith } from './string/endsWith.mjs';
192
+ export { escape } from './string/escape.mjs';
192
193
  export { kebabCase } from './string/kebabCase.mjs';
193
194
  export { lowerCase } from './string/lowerCase.mjs';
194
195
  export { pad } from './string/pad.mjs';
@@ -211,4 +212,5 @@ export { toInteger } from './util/toInteger.mjs';
211
212
  export { toLength } from './util/toLength.mjs';
212
213
  export { toNumber } from './util/toNumber.mjs';
213
214
  export { toPath } from './util/toPath.mjs';
215
+ export { toSafeInteger } from './util/toSafeInteger.mjs';
214
216
  export { toString } from './util/toString.mjs';