es-toolkit 1.20.0 → 1.21.0-dev.660

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 (126) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/_chunk/{isWeakSet-E_VMwB.js → isWeakSet-1xFSnK.js} +5 -0
  3. package/dist/_chunk/{toMerged-Bzkqyz.js → toMerged-D-sLFv.js} +10 -8
  4. package/dist/_chunk/{zipWith-CDtN9Y.js → zipWith-DEcUS4.js} +25 -12
  5. package/dist/array/compact.d.mts +4 -4
  6. package/dist/array/compact.d.ts +4 -4
  7. package/dist/array/compact.mjs +2 -1
  8. package/dist/array/countBy.mjs +2 -1
  9. package/dist/array/flatten.mjs +2 -1
  10. package/dist/array/groupBy.mjs +2 -1
  11. package/dist/array/index.js +1 -1
  12. package/dist/array/keyBy.mjs +2 -1
  13. package/dist/array/maxBy.d.mts +16 -0
  14. package/dist/array/maxBy.d.ts +16 -0
  15. package/dist/array/maxBy.mjs +2 -1
  16. package/dist/array/minBy.d.mts +16 -0
  17. package/dist/array/minBy.d.ts +16 -0
  18. package/dist/array/minBy.mjs +2 -1
  19. package/dist/array/partition.mjs +2 -1
  20. package/dist/array/takeWhile.mjs +2 -1
  21. package/dist/array/unionBy.mjs +3 -1
  22. package/dist/array/uniqBy.mjs +2 -1
  23. package/dist/array/uniqWith.mjs +2 -1
  24. package/dist/browser.global.js +1 -1
  25. package/dist/browser.global.js.map +1 -1
  26. package/dist/compat/array/castArray.d.mts +2 -2
  27. package/dist/compat/array/castArray.d.ts +2 -2
  28. package/dist/compat/array/flatten.mjs +2 -1
  29. package/dist/compat/function/curry.mjs +26 -34
  30. package/dist/compat/function/defer.d.mts +16 -0
  31. package/dist/compat/function/defer.d.ts +16 -0
  32. package/dist/compat/function/defer.mjs +8 -0
  33. package/dist/compat/index.d.mts +13 -5
  34. package/dist/compat/index.d.ts +13 -5
  35. package/dist/compat/index.js +200 -71
  36. package/dist/compat/index.mjs +14 -6
  37. package/dist/compat/math/inRange.d.mts +27 -0
  38. package/dist/compat/math/inRange.d.ts +27 -0
  39. package/dist/compat/math/inRange.mjs +28 -0
  40. package/dist/compat/math/max.mjs +2 -1
  41. package/dist/compat/math/min.mjs +2 -1
  42. package/dist/compat/math/random.d.mts +50 -0
  43. package/dist/compat/math/random.d.ts +50 -0
  44. package/dist/compat/math/random.mjs +70 -0
  45. package/dist/compat/object/cloneDeep.d.mts +49 -0
  46. package/dist/compat/object/cloneDeep.d.ts +49 -0
  47. package/dist/compat/object/pick.mjs +2 -1
  48. package/dist/compat/predicate/conformsTo.mjs +3 -1
  49. package/dist/compat/predicate/isArrayLikeObject.d.mts +15 -0
  50. package/dist/compat/predicate/isArrayLikeObject.d.ts +15 -0
  51. package/dist/compat/predicate/isArrayLikeObject.mjs +8 -0
  52. package/dist/compat/predicate/isBoolean.d.mts +3 -3
  53. package/dist/compat/predicate/isBoolean.d.ts +3 -3
  54. package/dist/compat/predicate/isBoolean.mjs +2 -10
  55. package/dist/compat/predicate/isError.d.mts +16 -0
  56. package/dist/compat/predicate/isError.d.ts +16 -0
  57. package/dist/compat/predicate/isError.mjs +7 -0
  58. package/dist/compat/predicate/isFinite.d.mts +20 -0
  59. package/dist/compat/predicate/isFinite.d.ts +20 -0
  60. package/dist/compat/predicate/isFinite.mjs +5 -0
  61. package/dist/compat/predicate/isNil.d.mts +22 -0
  62. package/dist/compat/predicate/isNil.d.ts +22 -0
  63. package/dist/compat/predicate/isNumber.mjs +1 -6
  64. package/dist/compat/predicate/isRegExp.mjs +2 -2
  65. package/dist/compat/predicate/isString.d.mts +1 -1
  66. package/dist/compat/predicate/isString.d.ts +1 -1
  67. package/dist/compat/predicate/isString.mjs +1 -9
  68. package/dist/compat/predicate/isSymbol.mjs +1 -1
  69. package/dist/compat/string/pad.d.mts +19 -0
  70. package/dist/compat/string/pad.d.ts +19 -0
  71. package/dist/compat/string/pad.mjs +8 -0
  72. package/dist/compat/string/padEnd.mjs +3 -1
  73. package/dist/compat/string/padStart.mjs +3 -1
  74. package/dist/compat/util/toFinite.d.mts +17 -0
  75. package/dist/compat/util/toFinite.d.ts +17 -0
  76. package/dist/compat/util/toFinite.mjs +15 -0
  77. package/dist/compat/util/toInteger.d.mts +17 -0
  78. package/dist/compat/util/toInteger.d.ts +17 -0
  79. package/dist/compat/util/toInteger.mjs +9 -0
  80. package/dist/compat/util/toNumber.d.mts +19 -0
  81. package/dist/compat/util/toNumber.d.ts +19 -0
  82. package/dist/compat/util/toNumber.mjs +10 -0
  83. package/dist/function/curry.d.mts +18 -19
  84. package/dist/function/curry.d.ts +18 -19
  85. package/dist/index.d.mts +2 -0
  86. package/dist/index.d.ts +2 -0
  87. package/dist/index.js +10 -8
  88. package/dist/index.mjs +2 -0
  89. package/dist/math/random.d.mts +1 -1
  90. package/dist/math/random.d.ts +1 -1
  91. package/dist/math/range.d.mts +7 -25
  92. package/dist/math/range.d.ts +7 -25
  93. package/dist/object/index.js +8 -4
  94. package/dist/object/omit.d.mts +1 -1
  95. package/dist/object/omit.d.ts +1 -1
  96. package/dist/object/omit.mjs +2 -1
  97. package/dist/object/omitBy.mjs +5 -4
  98. package/dist/object/pick.mjs +5 -2
  99. package/dist/object/pickBy.mjs +5 -4
  100. package/dist/predicate/index.d.mts +1 -0
  101. package/dist/predicate/index.d.ts +1 -0
  102. package/dist/predicate/index.js +5 -4
  103. package/dist/predicate/index.mjs +1 -0
  104. package/dist/predicate/isError.d.mts +16 -0
  105. package/dist/predicate/isError.d.ts +16 -0
  106. package/dist/predicate/isError.mjs +5 -0
  107. package/dist/promise/withTimeout.d.mts +8 -2
  108. package/dist/promise/withTimeout.d.ts +8 -2
  109. package/dist/string/_internal/getWords.mjs +1 -1
  110. package/dist/string/camelCase.d.mts +1 -0
  111. package/dist/string/camelCase.d.ts +1 -0
  112. package/dist/string/constantCase.d.mts +17 -0
  113. package/dist/string/constantCase.d.ts +17 -0
  114. package/dist/string/constantCase.mjs +8 -0
  115. package/dist/string/index.d.mts +1 -0
  116. package/dist/string/index.d.ts +1 -0
  117. package/dist/string/index.js +10 -8
  118. package/dist/string/index.mjs +1 -0
  119. package/dist/string/startCase.d.mts +1 -1
  120. package/dist/string/startCase.d.ts +1 -1
  121. package/dist/string/startCase.mjs +3 -7
  122. package/dist/string/trimStart.d.mts +1 -1
  123. package/dist/string/trimStart.d.ts +1 -1
  124. package/dist/string/upperFirst.d.mts +3 -3
  125. package/dist/string/upperFirst.d.ts +3 -3
  126. package/package.json +2 -1
@@ -1,5 +1,7 @@
1
+ import { toString } from '../util/toString.mjs';
2
+
1
3
  function padStart(str, length = 0, chars = ' ') {
2
- return str.padStart(length, chars);
4
+ return toString(str).padStart(length, chars);
3
5
  }
4
6
 
5
7
  export { padStart };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts `value` to a finite number.
3
+ *
4
+ * @param {unknown} value - The value to convert.
5
+ * @returns {number} Returns the number.
6
+ *
7
+ * @example
8
+ * toNumber(3.2); // => 3.2
9
+ * toNumber(Number.MIN_VALUE); // => 5e-324
10
+ * toNumber(Infinity); // => 1.7976931348623157e+308
11
+ * toNumber('3.2'); // => 3.2
12
+ * toNumber(Symbol.iterator); // => 0
13
+ * toNumber(NaN); // => 0
14
+ */
15
+ declare function toFinite(value?: unknown): number;
16
+
17
+ export { toFinite };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts `value` to a finite number.
3
+ *
4
+ * @param {unknown} value - The value to convert.
5
+ * @returns {number} Returns the number.
6
+ *
7
+ * @example
8
+ * toNumber(3.2); // => 3.2
9
+ * toNumber(Number.MIN_VALUE); // => 5e-324
10
+ * toNumber(Infinity); // => 1.7976931348623157e+308
11
+ * toNumber('3.2'); // => 3.2
12
+ * toNumber(Symbol.iterator); // => 0
13
+ * toNumber(NaN); // => 0
14
+ */
15
+ declare function toFinite(value?: unknown): number;
16
+
17
+ export { toFinite };
@@ -0,0 +1,15 @@
1
+ import { toNumber } from './toNumber.mjs';
2
+
3
+ function toFinite(value) {
4
+ if (!value) {
5
+ return value === 0 ? value : 0;
6
+ }
7
+ value = toNumber(value);
8
+ if (value === Infinity || value === -Infinity) {
9
+ const sign = value < 0 ? -1 : 1;
10
+ return sign * Number.MAX_VALUE;
11
+ }
12
+ return value === value ? value : 0;
13
+ }
14
+
15
+ export { toFinite };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts `value` to an integer.
3
+ *
4
+ * @param {unknown} value - The value to convert.
5
+ * @returns {number} Returns the number.
6
+ *
7
+ * @example
8
+ * toInteger(3.2); // => 3
9
+ * toInteger(Number.MIN_VALUE); // => 0
10
+ * toInteger(Infinity); // => 1.7976931348623157e+308
11
+ * toInteger('3.2'); // => 3
12
+ * toInteger(Symbol.iterator); // => 0
13
+ * toInteger(NaN); // => 0
14
+ */
15
+ declare function toInteger(value?: unknown): number;
16
+
17
+ export { toInteger };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Converts `value` to an integer.
3
+ *
4
+ * @param {unknown} value - The value to convert.
5
+ * @returns {number} Returns the number.
6
+ *
7
+ * @example
8
+ * toInteger(3.2); // => 3
9
+ * toInteger(Number.MIN_VALUE); // => 0
10
+ * toInteger(Infinity); // => 1.7976931348623157e+308
11
+ * toInteger('3.2'); // => 3
12
+ * toInteger(Symbol.iterator); // => 0
13
+ * toInteger(NaN); // => 0
14
+ */
15
+ declare function toInteger(value?: unknown): number;
16
+
17
+ export { toInteger };
@@ -0,0 +1,9 @@
1
+ import { toFinite } from './toFinite.mjs';
2
+
3
+ function toInteger(value) {
4
+ const finite = toFinite(value);
5
+ const remainder = finite % 1;
6
+ return remainder ? finite - remainder : finite;
7
+ }
8
+
9
+ export { toInteger };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Converts `value` to a number.
3
+ *
4
+ * Unlike `Number()`, this function returns `NaN` for symbols.
5
+ *
6
+ * @param {unknown} value - The value to convert.
7
+ * @returns {number} Returns the number.
8
+ *
9
+ * @example
10
+ * toNumber(3.2); // => 3.2
11
+ * toNumber(Number.MIN_VALUE); // => 5e-324
12
+ * toNumber(Infinity); // => Infinity
13
+ * toNumber('3.2'); // => 3.2
14
+ * toNumber(Symbol.iterator); // => NaN
15
+ * toNumber(NaN); // => NaN
16
+ */
17
+ declare function toNumber(value?: unknown): number;
18
+
19
+ export { toNumber };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Converts `value` to a number.
3
+ *
4
+ * Unlike `Number()`, this function returns `NaN` for symbols.
5
+ *
6
+ * @param {unknown} value - The value to convert.
7
+ * @returns {number} Returns the number.
8
+ *
9
+ * @example
10
+ * toNumber(3.2); // => 3.2
11
+ * toNumber(Number.MIN_VALUE); // => 5e-324
12
+ * toNumber(Infinity); // => Infinity
13
+ * toNumber('3.2'); // => 3.2
14
+ * toNumber(Symbol.iterator); // => NaN
15
+ * toNumber(NaN); // => NaN
16
+ */
17
+ declare function toNumber(value?: unknown): number;
18
+
19
+ export { toNumber };
@@ -0,0 +1,10 @@
1
+ import { isSymbol } from '../predicate/isSymbol.mjs';
2
+
3
+ function toNumber(value) {
4
+ if (isSymbol(value)) {
5
+ return NaN;
6
+ }
7
+ return Number(value);
8
+ }
9
+
10
+ export { toNumber };
@@ -48,18 +48,17 @@ declare function curry<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P1) => (p2:
48
48
  * Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
49
49
  * This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
50
50
  *
51
- * @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
52
- * @returns {(p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => R} A curried function.
51
+ * @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
52
+ * @returns {(p1: P1) => (p2: P2) => (p3: P3) => R} A curried function.
53
53
  *
54
54
  * @example
55
- * function fourArgFunc(a: number, b: number, c: number, d: number) {
56
- * return a + b + c + d;
55
+ * function threeArgFunc(a: number, b: number, c: number) {
56
+ * return a + b + c;
57
57
  * }
58
- * const curriedFourArgFunc = curry(fourArgFunc);
59
- * const add1 = curriedFourArgFunc(1);
60
- * const add2 = add1(2);
61
- * const add3 = add2(3);
62
- * console.log(add3(4)); // 10
58
+ * const curriedThreeArgFunc = curry(threeArgFunc);
59
+ * const add1 = curriedThreeArgFunc(1);
60
+ * const add3 = add1(2);
61
+ * console.log(add3(3)); // 6
63
62
  */
64
63
  declare function curry<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P1) => (p2: P2) => (p3: P3) => R;
65
64
  /**
@@ -75,9 +74,9 @@ declare function curry<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1:
75
74
  * }
76
75
  * const curriedFourArgFunc = curry(fourArgFunc);
77
76
  * const add1 = curriedFourArgFunc(1);
78
- * const add2 = add1(2);
79
- * const add3 = add2(3);
80
- * console.log(add3(4)); // 10
77
+ * const add3 = add1(2);
78
+ * const add6 = add3(3);
79
+ * console.log(add6(4)); // 10
81
80
  */
82
81
  declare function curry<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4) => R): (p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => R;
83
82
  /**
@@ -93,10 +92,10 @@ declare function curry<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4)
93
92
  * }
94
93
  * const curriedFiveArgFunc = curry(fiveArgFunc);
95
94
  * const add1 = curriedFiveArgFunc(1);
96
- * const add2 = add1(2);
97
- * const add3 = add2(3);
98
- * const add4 = add3(4);
99
- * console.log(add4(5)); // 15
95
+ * const add3 = add1(2);
96
+ * const add6 = add3(3);
97
+ * const add10 = add6(4);
98
+ * console.log(add10(5)); // 15
100
99
  */
101
100
  declare function curry<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => (p5: P5) => R;
102
101
  /**
@@ -114,13 +113,13 @@ declare function curry<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4:
114
113
  * const curriedSum = curry(sum);
115
114
  *
116
115
  * // The parameter `a` should be given the value `10`.
117
- * const sum10 = curriedSum(10);
116
+ * const add10 = curriedSum(10);
118
117
  *
119
118
  * // The parameter `b` should be given the value `15`.
120
- * const sum25 = sum10(15);
119
+ * const add25 = add10(15);
121
120
  *
122
121
  * // The parameter `c` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
123
- * const result = sum25(5);
122
+ * const result = add25(5);
124
123
  */
125
124
  declare function curry(func: (...args: any[]) => any): (...args: any[]) => any;
126
125
 
@@ -48,18 +48,17 @@ declare function curry<P1, P2, R>(func: (p1: P1, p2: P2) => R): (p1: P1) => (p2:
48
48
  * Curries a function, allowing it to be called with a single argument at a time and returning a new function that takes the next argument.
49
49
  * This process continues until all arguments have been provided, at which point the original function is called with all accumulated arguments.
50
50
  *
51
- * @param {(p1: P1, p2: P2, p3: P3, p4: P4) => R} func - The function to curry.
52
- * @returns {(p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => R} A curried function.
51
+ * @param {(p1: P1, p2: P2, p3: P3) => R} func - The function to curry.
52
+ * @returns {(p1: P1) => (p2: P2) => (p3: P3) => R} A curried function.
53
53
  *
54
54
  * @example
55
- * function fourArgFunc(a: number, b: number, c: number, d: number) {
56
- * return a + b + c + d;
55
+ * function threeArgFunc(a: number, b: number, c: number) {
56
+ * return a + b + c;
57
57
  * }
58
- * const curriedFourArgFunc = curry(fourArgFunc);
59
- * const add1 = curriedFourArgFunc(1);
60
- * const add2 = add1(2);
61
- * const add3 = add2(3);
62
- * console.log(add3(4)); // 10
58
+ * const curriedThreeArgFunc = curry(threeArgFunc);
59
+ * const add1 = curriedThreeArgFunc(1);
60
+ * const add3 = add1(2);
61
+ * console.log(add3(3)); // 6
63
62
  */
64
63
  declare function curry<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1: P1) => (p2: P2) => (p3: P3) => R;
65
64
  /**
@@ -75,9 +74,9 @@ declare function curry<P1, P2, P3, R>(func: (p1: P1, p2: P2, p3: P3) => R): (p1:
75
74
  * }
76
75
  * const curriedFourArgFunc = curry(fourArgFunc);
77
76
  * const add1 = curriedFourArgFunc(1);
78
- * const add2 = add1(2);
79
- * const add3 = add2(3);
80
- * console.log(add3(4)); // 10
77
+ * const add3 = add1(2);
78
+ * const add6 = add3(3);
79
+ * console.log(add6(4)); // 10
81
80
  */
82
81
  declare function curry<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4) => R): (p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => R;
83
82
  /**
@@ -93,10 +92,10 @@ declare function curry<P1, P2, P3, P4, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4)
93
92
  * }
94
93
  * const curriedFiveArgFunc = curry(fiveArgFunc);
95
94
  * const add1 = curriedFiveArgFunc(1);
96
- * const add2 = add1(2);
97
- * const add3 = add2(3);
98
- * const add4 = add3(4);
99
- * console.log(add4(5)); // 15
95
+ * const add3 = add1(2);
96
+ * const add6 = add3(3);
97
+ * const add10 = add6(4);
98
+ * console.log(add10(5)); // 15
100
99
  */
101
100
  declare function curry<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p1: P1) => (p2: P2) => (p3: P3) => (p4: P4) => (p5: P5) => R;
102
101
  /**
@@ -114,13 +113,13 @@ declare function curry<P1, P2, P3, P4, P5, R>(func: (p1: P1, p2: P2, p3: P3, p4:
114
113
  * const curriedSum = curry(sum);
115
114
  *
116
115
  * // The parameter `a` should be given the value `10`.
117
- * const sum10 = curriedSum(10);
116
+ * const add10 = curriedSum(10);
118
117
  *
119
118
  * // The parameter `b` should be given the value `15`.
120
- * const sum25 = sum10(15);
119
+ * const add25 = add10(15);
121
120
  *
122
121
  * // The parameter `c` should be given the value `5`. The function 'sum' has received all its arguments and will now return a value.
123
- * const result = sum25(5);
122
+ * const result = add25(5);
124
123
  */
125
124
  declare function curry(func: (...args: any[]) => any): (...args: any[]) => any;
126
125
 
package/dist/index.d.mts CHANGED
@@ -96,6 +96,7 @@ export { toMerged } from './object/toMerged.mjs';
96
96
  export { mergeWith } from './object/mergeWith.mjs';
97
97
  export { isDate } from './predicate/isDate.mjs';
98
98
  export { isEqual } from './predicate/isEqual.mjs';
99
+ export { isError } from './predicate/isError.mjs';
99
100
  export { isNil } from './predicate/isNil.mjs';
100
101
  export { isNotNil } from './predicate/isNotNil.mjs';
101
102
  export { isNull } from './predicate/isNull.mjs';
@@ -122,6 +123,7 @@ export { lowerCase } from './string/lowerCase.mjs';
122
123
  export { startCase } from './string/startCase.mjs';
123
124
  export { capitalize } from './string/capitalize.mjs';
124
125
  export { pascalCase } from './string/pascalCase.mjs';
126
+ export { constantCase } from './string/constantCase.mjs';
125
127
  export { trim } from './string/trim.mjs';
126
128
  export { trimStart } from './string/trimStart.mjs';
127
129
  export { trimEnd } from './string/trimEnd.mjs';
package/dist/index.d.ts CHANGED
@@ -96,6 +96,7 @@ export { toMerged } from './object/toMerged.js';
96
96
  export { mergeWith } from './object/mergeWith.js';
97
97
  export { isDate } from './predicate/isDate.js';
98
98
  export { isEqual } from './predicate/isEqual.js';
99
+ export { isError } from './predicate/isError.js';
99
100
  export { isNil } from './predicate/isNil.js';
100
101
  export { isNotNil } from './predicate/isNotNil.js';
101
102
  export { isNull } from './predicate/isNull.js';
@@ -122,6 +123,7 @@ export { lowerCase } from './string/lowerCase.js';
122
123
  export { startCase } from './string/startCase.js';
123
124
  export { capitalize } from './string/capitalize.js';
124
125
  export { pascalCase } from './string/pascalCase.js';
126
+ export { constantCase } from './string/constantCase.js';
125
127
  export { trim } from './string/trim.js';
126
128
  export { trimStart } from './string/trimStart.js';
127
129
  export { trimEnd } from './string/trimEnd.js';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const zipWith = require('./_chunk/zipWith-CDtN9Y.js');
5
+ const zipWith = require('./_chunk/zipWith-DEcUS4.js');
6
6
  const array_index = require('./array/index.js');
7
7
  const promise_index = require('./_chunk/index-BGZDR9.js');
8
8
  const rest = require('./_chunk/rest-pUyjvl.js');
@@ -11,10 +11,10 @@ const range = require('./_chunk/range-BXlMmn.js');
11
11
  const randomInt = require('./_chunk/randomInt-CF7bZK.js');
12
12
  const math_index = require('./math/index.js');
13
13
  const object_index = require('./object/index.js');
14
- const toMerged = require('./_chunk/toMerged-Bzkqyz.js');
15
- const isWeakSet = require('./_chunk/isWeakSet-E_VMwB.js');
16
- const isPlainObject = require('./_chunk/isPlainObject-BIekvL.js');
14
+ const toMerged = require('./_chunk/toMerged-D-sLFv.js');
15
+ const isWeakSet = require('./_chunk/isWeakSet-1xFSnK.js');
17
16
  const predicate_index = require('./predicate/index.js');
17
+ const isPlainObject = require('./_chunk/isPlainObject-BIekvL.js');
18
18
  const string_index = require('./string/index.js');
19
19
 
20
20
 
@@ -125,18 +125,20 @@ exports.isLength = isWeakSet.isLength;
125
125
  exports.isNil = isWeakSet.isNil;
126
126
  exports.isNotNil = isWeakSet.isNotNil;
127
127
  exports.isNull = isWeakSet.isNull;
128
+ exports.isRegExp = isWeakSet.isRegExp;
128
129
  exports.isUndefined = isWeakSet.isUndefined;
129
130
  exports.isWeakMap = isWeakSet.isWeakMap;
130
131
  exports.isWeakSet = isWeakSet.isWeakSet;
131
- exports.isPlainObject = isPlainObject.isPlainObject;
132
- exports.isPrimitive = isPlainObject.isPrimitive;
133
- exports.isTypedArray = isPlainObject.isTypedArray;
134
132
  exports.isBoolean = predicate_index.isBoolean;
135
- exports.isRegExp = predicate_index.isRegExp;
133
+ exports.isError = predicate_index.isError;
136
134
  exports.isString = predicate_index.isString;
137
135
  exports.isSymbol = predicate_index.isSymbol;
136
+ exports.isPlainObject = isPlainObject.isPlainObject;
137
+ exports.isPrimitive = isPlainObject.isPrimitive;
138
+ exports.isTypedArray = isPlainObject.isTypedArray;
138
139
  exports.camelCase = string_index.camelCase;
139
140
  exports.capitalize = string_index.capitalize;
141
+ exports.constantCase = string_index.constantCase;
140
142
  exports.deburr = string_index.deburr;
141
143
  exports.escape = string_index.escape;
142
144
  exports.escapeRegExp = string_index.escapeRegExp;
package/dist/index.mjs CHANGED
@@ -96,6 +96,7 @@ export { toMerged } from './object/toMerged.mjs';
96
96
  export { mergeWith } from './object/mergeWith.mjs';
97
97
  export { isDate } from './predicate/isDate.mjs';
98
98
  export { isEqual } from './predicate/isEqual.mjs';
99
+ export { isError } from './predicate/isError.mjs';
99
100
  export { isNil } from './predicate/isNil.mjs';
100
101
  export { isNotNil } from './predicate/isNotNil.mjs';
101
102
  export { isNull } from './predicate/isNull.mjs';
@@ -122,6 +123,7 @@ export { lowerCase } from './string/lowerCase.mjs';
122
123
  export { startCase } from './string/startCase.mjs';
123
124
  export { capitalize } from './string/capitalize.mjs';
124
125
  export { pascalCase } from './string/pascalCase.mjs';
126
+ export { constantCase } from './string/constantCase.mjs';
125
127
  export { trim } from './string/trim.mjs';
126
128
  export { trimStart } from './string/trimStart.mjs';
127
129
  export { trimEnd } from './string/trimEnd.mjs';
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @example
11
11
  * const result1 = random(5); // Returns a random number between 0 and 5.
12
- * const result2 = random(0); // Returns a random number between 0 and 0 (which is 0).
12
+ * const result2 = random(0); // If the `maximum` is less than or equal to 0, an error is thrown.
13
13
  */
14
14
  declare function random(maximum: number): number;
15
15
  /**
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @example
11
11
  * const result1 = random(5); // Returns a random number between 0 and 5.
12
- * const result2 = random(0); // Returns a random number between 0 and 0 (which is 0).
12
+ * const result2 = random(0); // If the `maximum` is less than or equal to 0, an error is thrown.
13
13
  */
14
14
  declare function random(maximum: number): number;
15
15
  /**
@@ -1,38 +1,20 @@
1
1
  /**
2
- * Returns an array of numbers from `start` to `end`, incrementing by `step`.
2
+ * Returns an array of numbers from `0` (inclusive) to `end` (exclusive), incrementing by `1`.
3
3
  *
4
- * If `step` is not provided, it defaults to `1`.
5
- *
6
- * @param {number} start - The starting number of the range (inclusive).
7
- * @param {number} [end] - The end number of the range (exclusive).
8
- * @param {number} [step] - The step value for the range. (default: 1)
9
- * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.
4
+ * @param {number} end - The end number of the range (exclusive).
5
+ * @returns {number[]} An array of numbers from `0` (inclusive) to `end` (exclusive) with a step of `1`.
10
6
  *
11
7
  * @example
12
8
  * // Returns [0, 1, 2, 3]
13
9
  * range(4);
14
- *
15
- * @example
16
- * // Returns [0, 5, 10, 15]
17
- * range(0, 20, 5);
18
- *
19
- * @example
20
- * // Returns [0, -1, -2, -3]
21
- * range(0, -4, -1);
22
- *
23
- * @example
24
- * // Throws an error: The step value must be a non-zero integer.
25
- * range(1, 4, 0);
26
10
  */
27
11
  declare function range(end: number): number[];
28
12
  /**
29
- * Returns an array of numbers from `start` to `end`, incrementing by `step`.
30
- *
31
- * If `step` is not provided, it defaults to `1`.
13
+ * Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `1`.
32
14
  *
33
15
  * @param {number} start - The starting number of the range (inclusive).
34
16
  * @param {number} end - The end number of the range (exclusive).
35
- * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.
17
+ * @returns {number[]} An array of numbers from `start` (inclusive) to `end` (exclusive) with a step of `1`.
36
18
  *
37
19
  * @example
38
20
  * // Returns [1, 2, 3]
@@ -40,12 +22,12 @@ declare function range(end: number): number[];
40
22
  */
41
23
  declare function range(start: number, end: number): number[];
42
24
  /**
43
- * Returns an array of numbers from `start` to `end`, incrementing by `step`.
25
+ * Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
44
26
  *
45
27
  * @param {number} start - The starting number of the range (inclusive).
46
28
  * @param {number} end - The end number of the range (exclusive).
47
29
  * @param {number} step - The step value for the range.
48
- * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.
30
+ * @returns {number[]} An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
49
31
  *
50
32
  * @example
51
33
  * // Returns [0, 5, 10, 15]
@@ -1,38 +1,20 @@
1
1
  /**
2
- * Returns an array of numbers from `start` to `end`, incrementing by `step`.
2
+ * Returns an array of numbers from `0` (inclusive) to `end` (exclusive), incrementing by `1`.
3
3
  *
4
- * If `step` is not provided, it defaults to `1`.
5
- *
6
- * @param {number} start - The starting number of the range (inclusive).
7
- * @param {number} [end] - The end number of the range (exclusive).
8
- * @param {number} [step] - The step value for the range. (default: 1)
9
- * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.
4
+ * @param {number} end - The end number of the range (exclusive).
5
+ * @returns {number[]} An array of numbers from `0` (inclusive) to `end` (exclusive) with a step of `1`.
10
6
  *
11
7
  * @example
12
8
  * // Returns [0, 1, 2, 3]
13
9
  * range(4);
14
- *
15
- * @example
16
- * // Returns [0, 5, 10, 15]
17
- * range(0, 20, 5);
18
- *
19
- * @example
20
- * // Returns [0, -1, -2, -3]
21
- * range(0, -4, -1);
22
- *
23
- * @example
24
- * // Throws an error: The step value must be a non-zero integer.
25
- * range(1, 4, 0);
26
10
  */
27
11
  declare function range(end: number): number[];
28
12
  /**
29
- * Returns an array of numbers from `start` to `end`, incrementing by `step`.
30
- *
31
- * If `step` is not provided, it defaults to `1`.
13
+ * Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `1`.
32
14
  *
33
15
  * @param {number} start - The starting number of the range (inclusive).
34
16
  * @param {number} end - The end number of the range (exclusive).
35
- * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.
17
+ * @returns {number[]} An array of numbers from `start` (inclusive) to `end` (exclusive) with a step of `1`.
36
18
  *
37
19
  * @example
38
20
  * // Returns [1, 2, 3]
@@ -40,12 +22,12 @@ declare function range(end: number): number[];
40
22
  */
41
23
  declare function range(start: number, end: number): number[];
42
24
  /**
43
- * Returns an array of numbers from `start` to `end`, incrementing by `step`.
25
+ * Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
44
26
  *
45
27
  * @param {number} start - The starting number of the range (inclusive).
46
28
  * @param {number} end - The end number of the range (exclusive).
47
29
  * @param {number} step - The step value for the range.
48
- * @returns {number[]} An array of numbers from `start` to `end` with the specified `step`.
30
+ * @returns {number[]} An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
49
31
  *
50
32
  * @example
51
33
  * // Returns [0, 5, 10, 15]
@@ -2,11 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const toMerged = require('../_chunk/toMerged-Bzkqyz.js');
5
+ const toMerged = require('../_chunk/toMerged-D-sLFv.js');
6
6
 
7
7
  function omit(obj, keys) {
8
8
  const result = { ...obj };
9
- for (const key of keys) {
9
+ for (let i = 0; i < keys.length; i++) {
10
+ const key = keys[i];
10
11
  delete result[key];
11
12
  }
12
13
  return result;
@@ -14,8 +15,11 @@ function omit(obj, keys) {
14
15
 
15
16
  function pick(obj, keys) {
16
17
  const result = {};
17
- for (const key of keys) {
18
- result[key] = obj[key];
18
+ for (let i = 0; i < keys.length; i++) {
19
+ const key = keys[i];
20
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
21
+ result[key] = obj[key];
22
+ }
19
23
  }
20
24
  return result;
21
25
  }
@@ -15,6 +15,6 @@
15
15
  * const result = omit(obj, ['b', 'c']);
16
16
  * // result will be { a: 1 }
17
17
  */
18
- declare function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
18
+ declare function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: readonly K[]): Omit<T, K>;
19
19
 
20
20
  export { omit };
@@ -15,6 +15,6 @@
15
15
  * const result = omit(obj, ['b', 'c']);
16
16
  * // result will be { a: 1 }
17
17
  */
18
- declare function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
18
+ declare function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: readonly K[]): Omit<T, K>;
19
19
 
20
20
  export { omit };
@@ -1,6 +1,7 @@
1
1
  function omit(obj, keys) {
2
2
  const result = { ...obj };
3
- for (const key of keys) {
3
+ for (let i = 0; i < keys.length; i++) {
4
+ const key = keys[i];
4
5
  delete result[key];
5
6
  }
6
7
  return result;
@@ -1,10 +1,11 @@
1
1
  function omitBy(obj, shouldOmit) {
2
2
  const result = {};
3
- for (const [key, value] of Object.entries(obj)) {
4
- if (shouldOmit(value, key)) {
5
- continue;
3
+ const objEntries = Object.entries(obj);
4
+ for (let i = 0; i < objEntries.length; i++) {
5
+ const [key, value] = objEntries[i];
6
+ if (!shouldOmit(value, key)) {
7
+ result[key] = value;
6
8
  }
7
- result[key] = value;
8
9
  }
9
10
  return result;
10
11
  }
@@ -1,7 +1,10 @@
1
1
  function pick(obj, keys) {
2
2
  const result = {};
3
- for (const key of keys) {
4
- result[key] = obj[key];
3
+ for (let i = 0; i < keys.length; i++) {
4
+ const key = keys[i];
5
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
6
+ result[key] = obj[key];
7
+ }
5
8
  }
6
9
  return result;
7
10
  }
@@ -1,10 +1,11 @@
1
1
  function pickBy(obj, shouldPick) {
2
2
  const result = {};
3
- for (const [key, value] of Object.entries(obj)) {
4
- if (!shouldPick(value, key)) {
5
- continue;
3
+ const objEntries = Object.entries(obj);
4
+ for (let i = 0; i < objEntries.length; i++) {
5
+ const [key, value] = objEntries[i];
6
+ if (shouldPick(value, key)) {
7
+ result[key] = value;
6
8
  }
7
- result[key] = value;
8
9
  }
9
10
  return result;
10
11
  }