es-toolkit 1.10.1 → 1.11.0-dev.263

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 (220) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/compat.d.ts +1 -0
  3. package/dist/array/chunk.mjs +1 -1
  4. package/dist/array/compact.mjs +1 -1
  5. package/dist/array/countBy.mjs +1 -1
  6. package/dist/array/difference.mjs +1 -1
  7. package/dist/array/differenceBy.mjs +1 -1
  8. package/dist/array/differenceWith.mjs +1 -1
  9. package/dist/array/drop.js +1 -0
  10. package/dist/array/drop.js.map +1 -1
  11. package/dist/array/drop.mjs +2 -2
  12. package/dist/array/dropRight.js +5 -1
  13. package/dist/array/dropRight.js.map +1 -1
  14. package/dist/array/dropRight.mjs +2 -2
  15. package/dist/array/dropRightWhile.js +6 -14
  16. package/dist/array/dropRightWhile.js.map +1 -1
  17. package/dist/array/dropRightWhile.mjs +2 -3
  18. package/dist/array/dropWhile.mjs +1 -1
  19. package/dist/array/fill.d.mts +10 -7
  20. package/dist/array/fill.d.ts +10 -7
  21. package/dist/array/fill.js +7 -6
  22. package/dist/array/fill.js.map +1 -1
  23. package/dist/array/fill.mjs +2 -2
  24. package/dist/array/flatMap.d.mts +23 -0
  25. package/dist/array/flatMap.d.ts +23 -0
  26. package/dist/array/flatMap.js +52 -0
  27. package/dist/array/flatMap.js.map +1 -0
  28. package/dist/array/flatMap.mjs +9 -0
  29. package/dist/array/flatten.mjs +1 -1
  30. package/dist/array/flattenDeep.mjs +1 -1
  31. package/dist/array/forEachRight.mjs +1 -1
  32. package/dist/array/groupBy.mjs +1 -1
  33. package/dist/array/head.mjs +1 -1
  34. package/dist/array/index.d.mts +1 -0
  35. package/dist/array/index.d.ts +1 -0
  36. package/dist/array/index.js +30 -14
  37. package/dist/array/index.js.map +1 -1
  38. package/dist/array/index.mjs +41 -37
  39. package/dist/array/initial.mjs +1 -1
  40. package/dist/array/intersection.mjs +1 -1
  41. package/dist/array/intersectionBy.mjs +1 -1
  42. package/dist/array/intersectionWith.mjs +1 -1
  43. package/dist/array/keyBy.mjs +1 -1
  44. package/dist/array/last.mjs +1 -1
  45. package/dist/array/maxBy.mjs +1 -1
  46. package/dist/array/minBy.mjs +1 -1
  47. package/dist/array/orderBy.mjs +1 -1
  48. package/dist/array/partition.mjs +1 -1
  49. package/dist/array/sample.mjs +1 -1
  50. package/dist/array/sampleSize.mjs +1 -1
  51. package/dist/array/shuffle.mjs +1 -1
  52. package/dist/array/tail.mjs +1 -1
  53. package/dist/array/take.mjs +1 -1
  54. package/dist/array/takeRight.mjs +1 -1
  55. package/dist/array/takeRightWhile.mjs +1 -1
  56. package/dist/array/takeWhile.mjs +1 -1
  57. package/dist/array/toFilled.mjs +1 -1
  58. package/dist/array/union.mjs +1 -1
  59. package/dist/array/unionBy.mjs +1 -1
  60. package/dist/array/unionWith.mjs +1 -1
  61. package/dist/array/uniq.mjs +1 -1
  62. package/dist/array/uniqBy.d.mts +1 -1
  63. package/dist/array/uniqBy.d.ts +1 -1
  64. package/dist/array/uniqBy.js.map +1 -1
  65. package/dist/array/uniqBy.mjs +2 -2
  66. package/dist/array/uniqWith.mjs +1 -1
  67. package/dist/array/unzip.mjs +1 -1
  68. package/dist/array/unzipWith.mjs +1 -1
  69. package/dist/array/without.mjs +1 -1
  70. package/dist/array/xor.mjs +1 -1
  71. package/dist/array/xorBy.mjs +1 -1
  72. package/dist/array/xorWith.mjs +1 -1
  73. package/dist/array/zip.mjs +1 -1
  74. package/dist/array/zipObject.mjs +1 -1
  75. package/dist/array/zipWith.mjs +1 -1
  76. package/dist/{chunk-S3CORED5.mjs → chunk-3EZAFZG3.mjs} +2 -1
  77. package/dist/{chunk-S3CORED5.mjs.map → chunk-3EZAFZG3.mjs.map} +1 -1
  78. package/dist/{chunk-2MM5EJJX.mjs → chunk-424M7IR7.mjs} +23 -2
  79. package/dist/chunk-4OIZM4HS.mjs +1 -0
  80. package/dist/{chunk-GDC64SYJ.mjs → chunk-5ASRKEB4.mjs} +1 -1
  81. package/dist/{chunk-GDC64SYJ.mjs.map → chunk-5ASRKEB4.mjs.map} +1 -1
  82. package/dist/{chunk-OXAZEEGP.mjs → chunk-B4COTK4K.mjs} +1 -1
  83. package/dist/{chunk-OXAZEEGP.mjs.map → chunk-B4COTK4K.mjs.map} +1 -1
  84. package/dist/chunk-DDH7K4QM.mjs +1 -0
  85. package/dist/chunk-F47GLYUU.mjs +1 -0
  86. package/dist/chunk-J3GE7DEU.mjs +22 -0
  87. package/dist/chunk-J3GE7DEU.mjs.map +1 -0
  88. package/dist/chunk-KIOYQRMQ.mjs +12 -0
  89. package/dist/chunk-KIOYQRMQ.mjs.map +1 -0
  90. package/dist/chunk-M7SBBYV2.mjs +14 -0
  91. package/dist/chunk-M7SBBYV2.mjs.map +1 -0
  92. package/dist/{chunk-IZAD2S7R.mjs → chunk-MY4G7R3I.mjs} +2 -2
  93. package/dist/{chunk-74WWMNZS.mjs → chunk-OLX53VEF.mjs} +4 -2
  94. package/dist/{chunk-74WWMNZS.mjs.map → chunk-OLX53VEF.mjs.map} +1 -1
  95. package/dist/chunk-OXZCMC5I.mjs +13 -0
  96. package/dist/{chunk-JEKUA56R.mjs.map → chunk-OXZCMC5I.mjs.map} +1 -1
  97. package/dist/chunk-QXTNZR7B.mjs +25 -0
  98. package/dist/chunk-QXTNZR7B.mjs.map +1 -0
  99. package/dist/{chunk-QZITBKWX.mjs → chunk-U7V3G7CR.mjs} +2 -2
  100. package/dist/chunk-UY76KTPE.mjs +13 -0
  101. package/dist/chunk-UY76KTPE.mjs.map +1 -0
  102. package/dist/chunk-XT74R35S.mjs +1 -0
  103. package/dist/chunk-XT74R35S.mjs.map +1 -0
  104. package/dist/chunk-XWPCDIFC.mjs +18 -0
  105. package/dist/chunk-XWPCDIFC.mjs.map +1 -0
  106. package/dist/chunk-YFN6KOC4.mjs +15 -0
  107. package/dist/chunk-YFN6KOC4.mjs.map +1 -0
  108. package/dist/compat/index.d.mts +392 -1
  109. package/dist/compat/index.d.ts +392 -1
  110. package/dist/compat/index.js +276 -21
  111. package/dist/compat/index.js.map +1 -1
  112. package/dist/compat/index.mjs +268 -87
  113. package/dist/compat/index.mjs.map +1 -1
  114. package/dist/error/AbortError.mjs +1 -1
  115. package/dist/error/TimeoutError.d.mts +9 -0
  116. package/dist/error/TimeoutError.d.ts +9 -0
  117. package/dist/error/TimeoutError.js +36 -0
  118. package/dist/error/TimeoutError.js.map +1 -0
  119. package/dist/error/TimeoutError.mjs +8 -0
  120. package/dist/error/TimeoutError.mjs.map +1 -0
  121. package/dist/error/index.d.mts +1 -0
  122. package/dist/error/index.d.ts +1 -0
  123. package/dist/error/index.js +12 -2
  124. package/dist/error/index.js.map +1 -1
  125. package/dist/error/index.mjs +7 -3
  126. package/dist/function/debounce.mjs +1 -1
  127. package/dist/function/index.mjs +7 -7
  128. package/dist/function/negate.mjs +1 -1
  129. package/dist/function/noop.mjs +1 -1
  130. package/dist/function/once.mjs +1 -1
  131. package/dist/function/throttle.mjs +1 -1
  132. package/dist/index.d.mts +4 -0
  133. package/dist/index.d.ts +4 -0
  134. package/dist/index.js +99 -15
  135. package/dist/index.js.map +1 -1
  136. package/dist/index.mjs +104 -87
  137. package/dist/math/clamp.mjs +1 -1
  138. package/dist/math/inRange.mjs +1 -1
  139. package/dist/math/index.js.map +1 -1
  140. package/dist/math/index.mjs +12 -12
  141. package/dist/math/mean.d.mts +1 -1
  142. package/dist/math/mean.d.ts +1 -1
  143. package/dist/math/mean.js.map +1 -1
  144. package/dist/math/mean.mjs +2 -2
  145. package/dist/math/meanBy.js.map +1 -1
  146. package/dist/math/meanBy.mjs +3 -3
  147. package/dist/math/random.mjs +1 -1
  148. package/dist/math/randomInt.mjs +1 -1
  149. package/dist/math/range.mjs +1 -1
  150. package/dist/math/round.mjs +1 -1
  151. package/dist/math/sum.mjs +1 -1
  152. package/dist/math/sumBy.mjs +1 -1
  153. package/dist/object/clone.mjs +1 -1
  154. package/dist/object/index.js +3 -1
  155. package/dist/object/index.js.map +1 -1
  156. package/dist/object/index.mjs +6 -6
  157. package/dist/object/invert.js +3 -1
  158. package/dist/object/invert.js.map +1 -1
  159. package/dist/object/invert.mjs +2 -2
  160. package/dist/object/omit.mjs +2 -2
  161. package/dist/object/omitBy.mjs +1 -1
  162. package/dist/object/pick.mjs +1 -1
  163. package/dist/object/pickBy.mjs +1 -1
  164. package/dist/predicate/index.mjs +1 -1
  165. package/dist/predicate/isEqual.mjs +1 -1
  166. package/dist/predicate/isNil.mjs +1 -1
  167. package/dist/predicate/isNotNil.mjs +1 -1
  168. package/dist/predicate/isNull.mjs +1 -1
  169. package/dist/predicate/isUndefined.mjs +1 -1
  170. package/dist/promise/delay.mjs +1 -1
  171. package/dist/promise/index.d.mts +1 -0
  172. package/dist/promise/index.d.ts +1 -0
  173. package/dist/promise/index.js +47 -2
  174. package/dist/promise/index.js.map +1 -1
  175. package/dist/promise/index.mjs +9 -3
  176. package/dist/promise/timeout.d.mts +10 -0
  177. package/dist/promise/timeout.d.ts +10 -0
  178. package/dist/promise/timeout.js +92 -0
  179. package/dist/promise/timeout.js.map +1 -0
  180. package/dist/promise/timeout.mjs +11 -0
  181. package/dist/promise/timeout.mjs.map +1 -0
  182. package/dist/promise/withTimeout.d.mts +22 -0
  183. package/dist/promise/withTimeout.d.ts +22 -0
  184. package/dist/promise/withTimeout.js +99 -0
  185. package/dist/promise/withTimeout.js.map +1 -0
  186. package/dist/promise/withTimeout.mjs +12 -0
  187. package/dist/promise/withTimeout.mjs.map +1 -0
  188. package/dist/string/camelCase.mjs +1 -1
  189. package/dist/string/capitalize.mjs +1 -1
  190. package/dist/string/index.d.mts +1 -0
  191. package/dist/string/index.d.ts +1 -0
  192. package/dist/string/index.js +21 -2
  193. package/dist/string/index.js.map +1 -1
  194. package/dist/string/index.mjs +13 -9
  195. package/dist/string/kebabCase.mjs +1 -1
  196. package/dist/string/lowerCase.mjs +1 -1
  197. package/dist/string/snakeCase.mjs +1 -1
  198. package/dist/string/startCase.d.mts +16 -0
  199. package/dist/string/startCase.d.ts +16 -0
  200. package/dist/string/startCase.js +54 -0
  201. package/dist/string/startCase.js.map +1 -0
  202. package/dist/string/startCase.mjs +9 -0
  203. package/dist/string/startCase.mjs.map +1 -0
  204. package/package.json +3 -5
  205. package/dist/chunk-2MRZANXZ.mjs +0 -1
  206. package/dist/chunk-ARZ5BDR6.mjs +0 -1
  207. package/dist/chunk-C4WE4GLC.mjs +0 -14
  208. package/dist/chunk-C4WE4GLC.mjs.map +0 -1
  209. package/dist/chunk-FZEZH22H.mjs +0 -1
  210. package/dist/chunk-JE6JKZU3.mjs +0 -15
  211. package/dist/chunk-JE6JKZU3.mjs.map +0 -1
  212. package/dist/chunk-JEKUA56R.mjs +0 -9
  213. package/dist/chunk-QKYYOLJ6.mjs +0 -1
  214. /package/dist/{chunk-2MM5EJJX.mjs.map → array/flatMap.mjs.map} +0 -0
  215. /package/dist/{chunk-2MRZANXZ.mjs.map → chunk-424M7IR7.mjs.map} +0 -0
  216. /package/dist/{chunk-ARZ5BDR6.mjs.map → chunk-4OIZM4HS.mjs.map} +0 -0
  217. /package/dist/{chunk-FZEZH22H.mjs.map → chunk-DDH7K4QM.mjs.map} +0 -0
  218. /package/dist/{chunk-QKYYOLJ6.mjs.map → chunk-F47GLYUU.mjs.map} +0 -0
  219. /package/dist/{chunk-IZAD2S7R.mjs.map → chunk-MY4G7R3I.mjs.map} +0 -0
  220. /package/dist/{chunk-QZITBKWX.mjs.map → chunk-U7V3G7CR.mjs.map} +0 -0
@@ -30,11 +30,32 @@ var __copyProps = (to, from, except, desc) => {
30
30
  return to;
31
31
  };
32
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
+ var __async = (__this, __arguments, generator) => {
34
+ return new Promise((resolve, reject) => {
35
+ var fulfilled = (value) => {
36
+ try {
37
+ step(generator.next(value));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ };
42
+ var rejected = (value) => {
43
+ try {
44
+ step(generator.throw(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ };
49
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
+ step((generator = generator.apply(__this, __arguments)).next());
51
+ });
52
+ };
33
53
 
34
54
  // src/compat/index.ts
35
55
  var compat_exports = {};
36
56
  __export(compat_exports, {
37
57
  AbortError: () => AbortError,
58
+ TimeoutError: () => TimeoutError,
38
59
  camelCase: () => camelCase,
39
60
  capitalize: () => capitalize,
40
61
  chunk: () => chunk2,
@@ -51,10 +72,13 @@ __export(compat_exports, {
51
72
  dropRight: () => dropRight,
52
73
  dropRightWhile: () => dropRightWhile,
53
74
  dropWhile: () => dropWhile,
75
+ endsWith: () => endsWith,
54
76
  fill: () => fill,
77
+ flatMap: () => flatMap,
55
78
  flatten: () => flatten,
56
79
  flattenDeep: () => flattenDeep,
57
80
  forEachRight: () => forEachRight,
81
+ get: () => get,
58
82
  groupBy: () => groupBy,
59
83
  head: () => head,
60
84
  inRange: () => inRange,
@@ -72,9 +96,11 @@ __export(compat_exports, {
72
96
  keyBy: () => keyBy,
73
97
  last: () => last,
74
98
  lowerCase: () => lowerCase,
99
+ max: () => max,
75
100
  maxBy: () => maxBy,
76
101
  mean: () => mean,
77
102
  meanBy: () => meanBy,
103
+ min: () => min,
78
104
  minBy: () => minBy,
79
105
  negate: () => negate,
80
106
  noop: () => noop,
@@ -91,8 +117,11 @@ __export(compat_exports, {
91
117
  round: () => round,
92
118
  sample: () => sample,
93
119
  sampleSize: () => sampleSize,
120
+ set: () => set,
94
121
  shuffle: () => shuffle,
95
122
  snakeCase: () => snakeCase,
123
+ startCase: () => startCase,
124
+ startsWith: () => startsWith,
96
125
  sum: () => sum,
97
126
  sumBy: () => sumBy,
98
127
  tail: () => tail,
@@ -110,12 +139,14 @@ __export(compat_exports, {
110
139
  uniqWith: () => uniqWith,
111
140
  unzip: () => unzip,
112
141
  unzipWith: () => unzipWith,
142
+ withTimeout: () => withTimeout,
113
143
  without: () => without,
114
144
  xor: () => xor,
115
145
  xorBy: () => xorBy,
116
146
  xorWith: () => xorWith,
117
147
  zip: () => zip,
118
148
  zipObject: () => zipObject,
149
+ zipObjectDeep: () => zipObjectDeep,
119
150
  zipWith: () => zipWith
120
151
  });
121
152
  module.exports = __toCommonJS(compat_exports);
@@ -182,12 +213,27 @@ function differenceWith(firstArr, secondArr, areItemsEqual) {
182
213
 
183
214
  // src/array/drop.ts
184
215
  function drop(arr, itemsCount) {
216
+ itemsCount = Math.max(itemsCount, 0);
185
217
  return arr.slice(itemsCount);
186
218
  }
187
219
 
188
220
  // src/array/dropRight.ts
189
221
  function dropRight(arr, itemsCount) {
190
- return arr.slice(0, -itemsCount);
222
+ itemsCount = Math.min(-itemsCount, 0);
223
+ if (itemsCount === 0) {
224
+ return arr.slice();
225
+ }
226
+ return arr.slice(0, itemsCount);
227
+ }
228
+
229
+ // src/array/dropRightWhile.ts
230
+ function dropRightWhile(arr, canContinueDropping) {
231
+ for (let i = arr.length - 1; i >= 0; i--) {
232
+ if (!canContinueDropping(arr[i])) {
233
+ return arr.slice(0, i + 1);
234
+ }
235
+ }
236
+ return [];
191
237
  }
192
238
 
193
239
  // src/array/dropWhile.ts
@@ -199,21 +245,15 @@ function dropWhile(arr, canContinueDropping) {
199
245
  return arr.slice(dropEndIndex);
200
246
  }
201
247
 
202
- // src/array/dropRightWhile.ts
203
- function dropRightWhile(arr, canContinueDropping) {
204
- const reversed = arr.slice().reverse();
205
- const dropped = dropWhile(reversed, canContinueDropping);
206
- return dropped.slice().reverse();
207
- }
208
-
209
248
  // src/array/fill.ts
210
- function fill(arr, value, start = 0, end = arr.length) {
211
- start = Math.max(start, 0);
212
- end = Math.min(end, arr.length);
213
- for (let i = start; i < end; i++) {
214
- arr[i] = value;
249
+ function fill(array, value, start = 0, end = array.length) {
250
+ const length = array.length;
251
+ const finalStart = Math.max(start >= 0 ? start : length + start, 0);
252
+ const finalEnd = Math.min(end >= 0 ? end : length + end, length);
253
+ for (let i = finalStart; i < finalEnd; i++) {
254
+ array[i] = value;
215
255
  }
216
- return arr;
256
+ return array;
217
257
  }
218
258
 
219
259
  // src/array/flatten.ts
@@ -233,6 +273,11 @@ function flatten(arr, depth = 1) {
233
273
  return result;
234
274
  }
235
275
 
276
+ // src/array/flatMap.ts
277
+ function flatMap(arr, iteratee, depth = 1) {
278
+ return flatten(arr.map((item) => iteratee(item)), depth);
279
+ }
280
+
236
281
  // src/array/flattenDeep.ts
237
282
  function flattenDeep(arr) {
238
283
  return flatten(arr, Infinity);
@@ -295,11 +340,11 @@ function keyBy(arr, getKeyFromItem) {
295
340
  // src/array/maxBy.ts
296
341
  function maxBy(items, getValue) {
297
342
  let maxElement = items[0];
298
- let max = -Infinity;
343
+ let max2 = -Infinity;
299
344
  for (const element of items) {
300
345
  const value = getValue(element);
301
- if (value > max) {
302
- max = value;
346
+ if (value > max2) {
347
+ max2 = value;
303
348
  maxElement = element;
304
349
  }
305
350
  }
@@ -309,11 +354,11 @@ function maxBy(items, getValue) {
309
354
  // src/array/minBy.ts
310
355
  function minBy(items, getValue) {
311
356
  let minElement = items[0];
312
- let min = Infinity;
357
+ let min2 = Infinity;
313
358
  for (const element of items) {
314
359
  const value = getValue(element);
315
- if (value < min) {
316
- min = value;
360
+ if (value < min2) {
361
+ min2 = value;
317
362
  minElement = element;
318
363
  }
319
364
  }
@@ -640,6 +685,14 @@ var AbortError = class extends Error {
640
685
  }
641
686
  };
642
687
 
688
+ // src/error/TimeoutError.ts
689
+ var TimeoutError = class extends Error {
690
+ constructor(message = "The operation was timed out") {
691
+ super(message);
692
+ this.name = "TimeoutError";
693
+ }
694
+ };
695
+
643
696
  // src/function/debounce.ts
644
697
  function debounce(func, debounceMs, { signal } = {}) {
645
698
  let timeoutId = null;
@@ -825,7 +878,9 @@ function pickBy(obj, shouldPick) {
825
878
  // src/object/invert.ts
826
879
  function invert(obj) {
827
880
  const result = {};
828
- for (const key in obj) {
881
+ const keys = Object.keys(obj);
882
+ for (let i = 0; i < keys.length; i++) {
883
+ const key = keys[i];
829
884
  const value = obj[key];
830
885
  result[value] = key;
831
886
  }
@@ -940,6 +995,21 @@ function delay(ms, { signal } = {}) {
940
995
  });
941
996
  }
942
997
 
998
+ // src/promise/timeout.ts
999
+ function timeout(ms) {
1000
+ return __async(this, null, function* () {
1001
+ yield delay(ms);
1002
+ throw new TimeoutError();
1003
+ });
1004
+ }
1005
+
1006
+ // src/promise/withTimeout.ts
1007
+ function withTimeout(run, ms) {
1008
+ return __async(this, null, function* () {
1009
+ return Promise.race([run(), timeout(ms)]);
1010
+ });
1011
+ }
1012
+
943
1013
  // src/string/capitalize.ts
944
1014
  var capitalize = (str) => {
945
1015
  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
@@ -980,6 +1050,23 @@ var lowerCase = (str) => {
980
1050
  return words.map((word) => word.toLowerCase()).join(" ");
981
1051
  };
982
1052
 
1053
+ // src/string/startCase.ts
1054
+ function startCase(str) {
1055
+ const words = getWords(str.trim());
1056
+ let result = "";
1057
+ for (const word of words) {
1058
+ if (result) {
1059
+ result += " ";
1060
+ }
1061
+ if (word === word.toUpperCase()) {
1062
+ result += word;
1063
+ } else {
1064
+ result += word[0].toUpperCase() + word.slice(1).toLowerCase();
1065
+ }
1066
+ }
1067
+ return result;
1068
+ }
1069
+
983
1070
  // src/compat/array/chunk.ts
984
1071
  function chunk2(arr, size = 1) {
985
1072
  size = Math.max(Math.floor(size), 0);
@@ -988,9 +1075,167 @@ function chunk2(arr, size = 1) {
988
1075
  }
989
1076
  return chunk(arr, size);
990
1077
  }
1078
+
1079
+ // src/compat/_internal/isIndex.ts
1080
+ var IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
1081
+ function isIndex(value) {
1082
+ switch (typeof value) {
1083
+ case "number": {
1084
+ return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
1085
+ }
1086
+ case "symbol": {
1087
+ return false;
1088
+ }
1089
+ case "string": {
1090
+ return IS_UNSIGNED_INTEGER.test(value);
1091
+ }
1092
+ }
1093
+ }
1094
+
1095
+ // src/compat/_internal/toPath.ts
1096
+ function toPath(deepKey) {
1097
+ const ESCAPE_REGEXP = /\\(\\)?/g;
1098
+ const PROPERTY_REGEXP = RegExp(
1099
+ // Match anything that isn't a dot or bracket.
1100
+ `[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,
1101
+ "g"
1102
+ );
1103
+ const result = [];
1104
+ if (deepKey[0] === ".") {
1105
+ result.push("");
1106
+ }
1107
+ let match;
1108
+ let lastIndex = 0;
1109
+ let count = 0;
1110
+ while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {
1111
+ let [key, expr, quote, substr] = match;
1112
+ if (quote) {
1113
+ key = substr.replace(ESCAPE_REGEXP, "$1");
1114
+ } else if (expr) {
1115
+ key = expr;
1116
+ }
1117
+ result.push(key);
1118
+ if (PROPERTY_REGEXP.lastIndex === lastIndex) {
1119
+ PROPERTY_REGEXP.lastIndex++;
1120
+ } else {
1121
+ lastIndex = PROPERTY_REGEXP.lastIndex;
1122
+ }
1123
+ }
1124
+ return result;
1125
+ }
1126
+
1127
+ // src/compat/object/set.ts
1128
+ function set(obj, path, value) {
1129
+ const resolvedPath = Array.isArray(path) ? path : typeof path === "string" ? toPath(path) : [path];
1130
+ let current = obj;
1131
+ for (let i = 0; i < resolvedPath.length - 1; i++) {
1132
+ const key = resolvedPath[i];
1133
+ const nextKey = resolvedPath[i + 1];
1134
+ if (current[key] == null) {
1135
+ current[key] = isIndex(nextKey) ? [] : {};
1136
+ }
1137
+ current = current[key];
1138
+ }
1139
+ const lastKey = resolvedPath[resolvedPath.length - 1];
1140
+ current[lastKey] = value;
1141
+ return obj;
1142
+ }
1143
+
1144
+ // src/compat/array/zipObjectDeep.ts
1145
+ function zipObjectDeep(keys, values) {
1146
+ const result = {};
1147
+ const zipped = zip(keys, values);
1148
+ for (let i = 0; i < zipped.length; i++) {
1149
+ const [key, value] = zipped[i];
1150
+ if (key != null) {
1151
+ set(result, key, value);
1152
+ }
1153
+ }
1154
+ return result;
1155
+ }
1156
+
1157
+ // src/compat/_internal/isDeepKey.ts
1158
+ var IS_PLAIN = /^\w*$/;
1159
+ var IS_DEEP = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
1160
+ function isDeepKey(key) {
1161
+ switch (typeof key) {
1162
+ case "number":
1163
+ case "symbol": {
1164
+ return false;
1165
+ }
1166
+ case "string": {
1167
+ return !IS_PLAIN.test(key) && IS_DEEP.test(key);
1168
+ }
1169
+ }
1170
+ }
1171
+
1172
+ // src/compat/object/get.ts
1173
+ function get(object, path, defaultValue) {
1174
+ let resolvedPath;
1175
+ if (Array.isArray(path)) {
1176
+ resolvedPath = path;
1177
+ } else if (typeof path === "string" && isDeepKey(path) && (object == null ? void 0 : object[path]) == null) {
1178
+ resolvedPath = toPath(path);
1179
+ } else {
1180
+ resolvedPath = [path];
1181
+ }
1182
+ if (resolvedPath.length === 0) {
1183
+ return defaultValue;
1184
+ }
1185
+ let current = object;
1186
+ let index;
1187
+ for (index = 0; index < resolvedPath.length && current != null; index++) {
1188
+ let key = resolvedPath[index];
1189
+ if (Object.is(key.valueOf(), -0)) {
1190
+ key = "-0";
1191
+ }
1192
+ current = current[key];
1193
+ }
1194
+ if (current === null && index === resolvedPath.length) {
1195
+ return current;
1196
+ }
1197
+ return current != null ? current : defaultValue;
1198
+ }
1199
+
1200
+ // src/compat/string/startsWith.ts
1201
+ var startsWith = (str, target, position = 0) => {
1202
+ return str.startsWith(target, position);
1203
+ };
1204
+
1205
+ // src/compat/string/endsWith.ts
1206
+ var endsWith = (str, target, position = str.length) => {
1207
+ return str.endsWith(target, position);
1208
+ };
1209
+
1210
+ // src/compat/math/max.ts
1211
+ function max(items = []) {
1212
+ let maxElement = items[0];
1213
+ let max2 = void 0;
1214
+ for (const element of items) {
1215
+ if (max2 == null || element > max2) {
1216
+ max2 = element;
1217
+ maxElement = element;
1218
+ }
1219
+ }
1220
+ return maxElement;
1221
+ }
1222
+
1223
+ // src/compat/math/min.ts
1224
+ function min(items = []) {
1225
+ let minElement = items[0];
1226
+ let min2 = void 0;
1227
+ for (const element of items) {
1228
+ if (min2 == null || element < min2) {
1229
+ min2 = element;
1230
+ minElement = element;
1231
+ }
1232
+ }
1233
+ return minElement;
1234
+ }
991
1235
  // Annotate the CommonJS export names for ESM import in node:
992
1236
  0 && (module.exports = {
993
1237
  AbortError,
1238
+ TimeoutError,
994
1239
  camelCase,
995
1240
  capitalize,
996
1241
  chunk,
@@ -1007,10 +1252,13 @@ function chunk2(arr, size = 1) {
1007
1252
  dropRight,
1008
1253
  dropRightWhile,
1009
1254
  dropWhile,
1255
+ endsWith,
1010
1256
  fill,
1257
+ flatMap,
1011
1258
  flatten,
1012
1259
  flattenDeep,
1013
1260
  forEachRight,
1261
+ get,
1014
1262
  groupBy,
1015
1263
  head,
1016
1264
  inRange,
@@ -1028,9 +1276,11 @@ function chunk2(arr, size = 1) {
1028
1276
  keyBy,
1029
1277
  last,
1030
1278
  lowerCase,
1279
+ max,
1031
1280
  maxBy,
1032
1281
  mean,
1033
1282
  meanBy,
1283
+ min,
1034
1284
  minBy,
1035
1285
  negate,
1036
1286
  noop,
@@ -1047,8 +1297,11 @@ function chunk2(arr, size = 1) {
1047
1297
  round,
1048
1298
  sample,
1049
1299
  sampleSize,
1300
+ set,
1050
1301
  shuffle,
1051
1302
  snakeCase,
1303
+ startCase,
1304
+ startsWith,
1052
1305
  sum,
1053
1306
  sumBy,
1054
1307
  tail,
@@ -1066,12 +1319,14 @@ function chunk2(arr, size = 1) {
1066
1319
  uniqWith,
1067
1320
  unzip,
1068
1321
  unzipWith,
1322
+ withTimeout,
1069
1323
  without,
1070
1324
  xor,
1071
1325
  xorBy,
1072
1326
  xorWith,
1073
1327
  zip,
1074
1328
  zipObject,
1329
+ zipObjectDeep,
1075
1330
  zipWith
1076
1331
  });
1077
1332
  //# sourceMappingURL=index.js.map