es-toolkit 1.10.1 → 1.11.0-dev.261

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 +360 -1
  109. package/dist/compat/index.d.ts +360 -1
  110. package/dist/compat/index.js +240 -15
  111. package/dist/compat/index.js.map +1 -1
  112. package/dist/compat/index.mjs +235 -82
  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 +4 -4
  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 +99 -82
  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,
@@ -91,8 +115,11 @@ __export(compat_exports, {
91
115
  round: () => round,
92
116
  sample: () => sample,
93
117
  sampleSize: () => sampleSize,
118
+ set: () => set,
94
119
  shuffle: () => shuffle,
95
120
  snakeCase: () => snakeCase,
121
+ startCase: () => startCase,
122
+ startsWith: () => startsWith,
96
123
  sum: () => sum,
97
124
  sumBy: () => sumBy,
98
125
  tail: () => tail,
@@ -110,12 +137,14 @@ __export(compat_exports, {
110
137
  uniqWith: () => uniqWith,
111
138
  unzip: () => unzip,
112
139
  unzipWith: () => unzipWith,
140
+ withTimeout: () => withTimeout,
113
141
  without: () => without,
114
142
  xor: () => xor,
115
143
  xorBy: () => xorBy,
116
144
  xorWith: () => xorWith,
117
145
  zip: () => zip,
118
146
  zipObject: () => zipObject,
147
+ zipObjectDeep: () => zipObjectDeep,
119
148
  zipWith: () => zipWith
120
149
  });
121
150
  module.exports = __toCommonJS(compat_exports);
@@ -182,12 +211,27 @@ function differenceWith(firstArr, secondArr, areItemsEqual) {
182
211
 
183
212
  // src/array/drop.ts
184
213
  function drop(arr, itemsCount) {
214
+ itemsCount = Math.max(itemsCount, 0);
185
215
  return arr.slice(itemsCount);
186
216
  }
187
217
 
188
218
  // src/array/dropRight.ts
189
219
  function dropRight(arr, itemsCount) {
190
- return arr.slice(0, -itemsCount);
220
+ itemsCount = Math.min(-itemsCount, 0);
221
+ if (itemsCount === 0) {
222
+ return arr.slice();
223
+ }
224
+ return arr.slice(0, itemsCount);
225
+ }
226
+
227
+ // src/array/dropRightWhile.ts
228
+ function dropRightWhile(arr, canContinueDropping) {
229
+ for (let i = arr.length - 1; i >= 0; i--) {
230
+ if (!canContinueDropping(arr[i])) {
231
+ return arr.slice(0, i + 1);
232
+ }
233
+ }
234
+ return [];
191
235
  }
192
236
 
193
237
  // src/array/dropWhile.ts
@@ -199,21 +243,15 @@ function dropWhile(arr, canContinueDropping) {
199
243
  return arr.slice(dropEndIndex);
200
244
  }
201
245
 
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
246
  // 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;
247
+ function fill(array, value, start = 0, end = array.length) {
248
+ const length = array.length;
249
+ const finalStart = Math.max(start >= 0 ? start : length + start, 0);
250
+ const finalEnd = Math.min(end >= 0 ? end : length + end, length);
251
+ for (let i = finalStart; i < finalEnd; i++) {
252
+ array[i] = value;
215
253
  }
216
- return arr;
254
+ return array;
217
255
  }
218
256
 
219
257
  // src/array/flatten.ts
@@ -233,6 +271,11 @@ function flatten(arr, depth = 1) {
233
271
  return result;
234
272
  }
235
273
 
274
+ // src/array/flatMap.ts
275
+ function flatMap(arr, iteratee, depth = 1) {
276
+ return flatten(arr.map((item) => iteratee(item)), depth);
277
+ }
278
+
236
279
  // src/array/flattenDeep.ts
237
280
  function flattenDeep(arr) {
238
281
  return flatten(arr, Infinity);
@@ -640,6 +683,14 @@ var AbortError = class extends Error {
640
683
  }
641
684
  };
642
685
 
686
+ // src/error/TimeoutError.ts
687
+ var TimeoutError = class extends Error {
688
+ constructor(message = "The operation was timed out") {
689
+ super(message);
690
+ this.name = "TimeoutError";
691
+ }
692
+ };
693
+
643
694
  // src/function/debounce.ts
644
695
  function debounce(func, debounceMs, { signal } = {}) {
645
696
  let timeoutId = null;
@@ -825,7 +876,9 @@ function pickBy(obj, shouldPick) {
825
876
  // src/object/invert.ts
826
877
  function invert(obj) {
827
878
  const result = {};
828
- for (const key in obj) {
879
+ const keys = Object.keys(obj);
880
+ for (let i = 0; i < keys.length; i++) {
881
+ const key = keys[i];
829
882
  const value = obj[key];
830
883
  result[value] = key;
831
884
  }
@@ -940,6 +993,21 @@ function delay(ms, { signal } = {}) {
940
993
  });
941
994
  }
942
995
 
996
+ // src/promise/timeout.ts
997
+ function timeout(ms) {
998
+ return __async(this, null, function* () {
999
+ yield delay(ms);
1000
+ throw new TimeoutError();
1001
+ });
1002
+ }
1003
+
1004
+ // src/promise/withTimeout.ts
1005
+ function withTimeout(run, ms) {
1006
+ return __async(this, null, function* () {
1007
+ return Promise.race([run(), timeout(ms)]);
1008
+ });
1009
+ }
1010
+
943
1011
  // src/string/capitalize.ts
944
1012
  var capitalize = (str) => {
945
1013
  return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
@@ -980,6 +1048,23 @@ var lowerCase = (str) => {
980
1048
  return words.map((word) => word.toLowerCase()).join(" ");
981
1049
  };
982
1050
 
1051
+ // src/string/startCase.ts
1052
+ function startCase(str) {
1053
+ const words = getWords(str.trim());
1054
+ let result = "";
1055
+ for (const word of words) {
1056
+ if (result) {
1057
+ result += " ";
1058
+ }
1059
+ if (word === word.toUpperCase()) {
1060
+ result += word;
1061
+ } else {
1062
+ result += word[0].toUpperCase() + word.slice(1).toLowerCase();
1063
+ }
1064
+ }
1065
+ return result;
1066
+ }
1067
+
983
1068
  // src/compat/array/chunk.ts
984
1069
  function chunk2(arr, size = 1) {
985
1070
  size = Math.max(Math.floor(size), 0);
@@ -988,9 +1073,141 @@ function chunk2(arr, size = 1) {
988
1073
  }
989
1074
  return chunk(arr, size);
990
1075
  }
1076
+
1077
+ // src/compat/_internal/isIndex.ts
1078
+ var IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
1079
+ function isIndex(value) {
1080
+ switch (typeof value) {
1081
+ case "number": {
1082
+ return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
1083
+ }
1084
+ case "symbol": {
1085
+ return false;
1086
+ }
1087
+ case "string": {
1088
+ return IS_UNSIGNED_INTEGER.test(value);
1089
+ }
1090
+ }
1091
+ }
1092
+
1093
+ // src/compat/_internal/toPath.ts
1094
+ function toPath(deepKey) {
1095
+ const ESCAPE_REGEXP = /\\(\\)?/g;
1096
+ const PROPERTY_REGEXP = RegExp(
1097
+ // Match anything that isn't a dot or bracket.
1098
+ `[^.[\\]]+|\\[(?:([^"'][^[]*)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))`,
1099
+ "g"
1100
+ );
1101
+ const result = [];
1102
+ if (deepKey[0] === ".") {
1103
+ result.push("");
1104
+ }
1105
+ let match;
1106
+ let lastIndex = 0;
1107
+ let count = 0;
1108
+ while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {
1109
+ let [key, expr, quote, substr] = match;
1110
+ if (quote) {
1111
+ key = substr.replace(ESCAPE_REGEXP, "$1");
1112
+ } else if (expr) {
1113
+ key = expr;
1114
+ }
1115
+ result.push(key);
1116
+ if (PROPERTY_REGEXP.lastIndex === lastIndex) {
1117
+ PROPERTY_REGEXP.lastIndex++;
1118
+ } else {
1119
+ lastIndex = PROPERTY_REGEXP.lastIndex;
1120
+ }
1121
+ }
1122
+ return result;
1123
+ }
1124
+
1125
+ // src/compat/object/set.ts
1126
+ function set(obj, path, value) {
1127
+ const resolvedPath = Array.isArray(path) ? path : typeof path === "string" ? toPath(path) : [path];
1128
+ let current = obj;
1129
+ for (let i = 0; i < resolvedPath.length - 1; i++) {
1130
+ const key = resolvedPath[i];
1131
+ const nextKey = resolvedPath[i + 1];
1132
+ if (current[key] == null) {
1133
+ current[key] = isIndex(nextKey) ? [] : {};
1134
+ }
1135
+ current = current[key];
1136
+ }
1137
+ const lastKey = resolvedPath[resolvedPath.length - 1];
1138
+ current[lastKey] = value;
1139
+ return obj;
1140
+ }
1141
+
1142
+ // src/compat/array/zipObjectDeep.ts
1143
+ function zipObjectDeep(keys, values) {
1144
+ const result = {};
1145
+ const zipped = zip(keys, values);
1146
+ for (let i = 0; i < zipped.length; i++) {
1147
+ const [key, value] = zipped[i];
1148
+ if (key != null) {
1149
+ set(result, key, value);
1150
+ }
1151
+ }
1152
+ return result;
1153
+ }
1154
+
1155
+ // src/compat/_internal/isDeepKey.ts
1156
+ var IS_PLAIN = /^\w*$/;
1157
+ var IS_DEEP = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
1158
+ function isDeepKey(key) {
1159
+ switch (typeof key) {
1160
+ case "number":
1161
+ case "symbol": {
1162
+ return false;
1163
+ }
1164
+ case "string": {
1165
+ return !IS_PLAIN.test(key) && IS_DEEP.test(key);
1166
+ }
1167
+ }
1168
+ }
1169
+
1170
+ // src/compat/object/get.ts
1171
+ function get(object, path, defaultValue) {
1172
+ let resolvedPath;
1173
+ if (Array.isArray(path)) {
1174
+ resolvedPath = path;
1175
+ } else if (typeof path === "string" && isDeepKey(path) && (object == null ? void 0 : object[path]) == null) {
1176
+ resolvedPath = toPath(path);
1177
+ } else {
1178
+ resolvedPath = [path];
1179
+ }
1180
+ if (resolvedPath.length === 0) {
1181
+ return defaultValue;
1182
+ }
1183
+ let current = object;
1184
+ let index;
1185
+ for (index = 0; index < resolvedPath.length && current != null; index++) {
1186
+ let key = resolvedPath[index];
1187
+ if (Object.is(key.valueOf(), -0)) {
1188
+ key = "-0";
1189
+ }
1190
+ current = current[key];
1191
+ }
1192
+ if (current === null && index === resolvedPath.length) {
1193
+ return current;
1194
+ }
1195
+ return current != null ? current : defaultValue;
1196
+ }
1197
+
1198
+ // src/compat/string/startsWith.ts
1199
+ var startsWith = (str, target, position = 0) => {
1200
+ return str.startsWith(target, position);
1201
+ };
1202
+
1203
+ // src/compat/string/endsWith.ts
1204
+ var endsWith = (str, target, position = str.length) => {
1205
+ return str.endsWith(target, position);
1206
+ };
991
1207
  // Annotate the CommonJS export names for ESM import in node:
992
1208
  0 && (module.exports = {
993
1209
  AbortError,
1210
+ TimeoutError,
994
1211
  camelCase,
995
1212
  capitalize,
996
1213
  chunk,
@@ -1007,10 +1224,13 @@ function chunk2(arr, size = 1) {
1007
1224
  dropRight,
1008
1225
  dropRightWhile,
1009
1226
  dropWhile,
1227
+ endsWith,
1010
1228
  fill,
1229
+ flatMap,
1011
1230
  flatten,
1012
1231
  flattenDeep,
1013
1232
  forEachRight,
1233
+ get,
1014
1234
  groupBy,
1015
1235
  head,
1016
1236
  inRange,
@@ -1047,8 +1267,11 @@ function chunk2(arr, size = 1) {
1047
1267
  round,
1048
1268
  sample,
1049
1269
  sampleSize,
1270
+ set,
1050
1271
  shuffle,
1051
1272
  snakeCase,
1273
+ startCase,
1274
+ startsWith,
1052
1275
  sum,
1053
1276
  sumBy,
1054
1277
  tail,
@@ -1066,12 +1289,14 @@ function chunk2(arr, size = 1) {
1066
1289
  uniqWith,
1067
1290
  unzip,
1068
1291
  unzipWith,
1292
+ withTimeout,
1069
1293
  without,
1070
1294
  xor,
1071
1295
  xorBy,
1072
1296
  xorWith,
1073
1297
  zip,
1074
1298
  zipObject,
1299
+ zipObjectDeep,
1075
1300
  zipWith
1076
1301
  });
1077
1302
  //# sourceMappingURL=index.js.map