es-toolkit 1.10.1-dev.250 → 1.10.1-dev.252

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 (168) hide show
  1. package/dist/array/chunk.mjs +1 -1
  2. package/dist/array/compact.mjs +1 -1
  3. package/dist/array/countBy.mjs +1 -1
  4. package/dist/array/difference.mjs +1 -1
  5. package/dist/array/differenceBy.mjs +1 -1
  6. package/dist/array/differenceWith.mjs +1 -1
  7. package/dist/array/drop.mjs +1 -1
  8. package/dist/array/dropRight.mjs +1 -1
  9. package/dist/array/dropRightWhile.mjs +1 -1
  10. package/dist/array/dropWhile.mjs +1 -1
  11. package/dist/array/fill.mjs +1 -1
  12. package/dist/array/flatMap.mjs +1 -1
  13. package/dist/array/flatten.mjs +1 -1
  14. package/dist/array/flattenDeep.mjs +1 -1
  15. package/dist/array/forEachRight.mjs +1 -1
  16. package/dist/array/groupBy.mjs +1 -1
  17. package/dist/array/head.mjs +1 -1
  18. package/dist/array/index.mjs +20 -20
  19. package/dist/array/initial.mjs +1 -1
  20. package/dist/array/intersection.mjs +1 -1
  21. package/dist/array/intersectionBy.mjs +1 -1
  22. package/dist/array/intersectionWith.mjs +1 -1
  23. package/dist/array/keyBy.mjs +1 -1
  24. package/dist/array/last.mjs +1 -1
  25. package/dist/array/maxBy.mjs +1 -1
  26. package/dist/array/minBy.mjs +1 -1
  27. package/dist/array/orderBy.mjs +1 -1
  28. package/dist/array/partition.mjs +1 -1
  29. package/dist/array/sample.mjs +1 -1
  30. package/dist/array/sampleSize.mjs +1 -1
  31. package/dist/array/shuffle.mjs +1 -1
  32. package/dist/array/tail.mjs +1 -1
  33. package/dist/array/take.mjs +1 -1
  34. package/dist/array/takeRight.mjs +1 -1
  35. package/dist/array/takeRightWhile.mjs +1 -1
  36. package/dist/array/takeWhile.mjs +1 -1
  37. package/dist/array/toFilled.mjs +1 -1
  38. package/dist/array/union.mjs +1 -1
  39. package/dist/array/unionBy.mjs +1 -1
  40. package/dist/array/unionWith.mjs +1 -1
  41. package/dist/array/uniq.mjs +1 -1
  42. package/dist/array/uniqBy.mjs +1 -1
  43. package/dist/array/uniqWith.mjs +1 -1
  44. package/dist/array/unzip.mjs +1 -1
  45. package/dist/array/unzipWith.mjs +1 -1
  46. package/dist/array/without.mjs +1 -1
  47. package/dist/array/xor.mjs +1 -1
  48. package/dist/array/xorBy.mjs +1 -1
  49. package/dist/array/xorWith.mjs +1 -1
  50. package/dist/array/zip.mjs +1 -1
  51. package/dist/array/zipObject.mjs +1 -1
  52. package/dist/array/zipWith.mjs +1 -1
  53. package/dist/{chunk-2MM5EJJX.mjs → chunk-424M7IR7.mjs} +23 -2
  54. package/dist/chunk-4OIZM4HS.mjs +1 -0
  55. package/dist/chunk-F47GLYUU.mjs +1 -0
  56. package/dist/chunk-J3GE7DEU.mjs +22 -0
  57. package/dist/chunk-J3GE7DEU.mjs.map +1 -0
  58. package/dist/chunk-KIOYQRMQ.mjs +12 -0
  59. package/dist/chunk-KIOYQRMQ.mjs.map +1 -0
  60. package/dist/{chunk-QZITBKWX.mjs → chunk-U7V3G7CR.mjs} +2 -2
  61. package/dist/chunk-XT74R35S.mjs +1 -0
  62. package/dist/chunk-XWPCDIFC.mjs +18 -0
  63. package/dist/chunk-XWPCDIFC.mjs.map +1 -0
  64. package/dist/compat/index.d.mts +41 -3
  65. package/dist/compat/index.d.ts +41 -3
  66. package/dist/compat/index.js +57 -10
  67. package/dist/compat/index.js.map +1 -1
  68. package/dist/compat/index.mjs +68 -55
  69. package/dist/compat/index.mjs.map +1 -1
  70. package/dist/error/AbortError.mjs +1 -1
  71. package/dist/error/TimeoutError.d.mts +9 -0
  72. package/dist/error/TimeoutError.d.ts +9 -0
  73. package/dist/{string/startsWith.js → error/TimeoutError.js} +12 -9
  74. package/dist/error/TimeoutError.js.map +1 -0
  75. package/dist/error/TimeoutError.mjs +8 -0
  76. package/dist/error/index.d.mts +1 -0
  77. package/dist/error/index.d.ts +1 -0
  78. package/dist/error/index.js +12 -2
  79. package/dist/error/index.js.map +1 -1
  80. package/dist/error/index.mjs +7 -3
  81. package/dist/function/debounce.mjs +1 -1
  82. package/dist/function/index.mjs +4 -4
  83. package/dist/function/negate.mjs +1 -1
  84. package/dist/function/noop.mjs +1 -1
  85. package/dist/function/once.mjs +1 -1
  86. package/dist/function/throttle.mjs +1 -1
  87. package/dist/index.d.mts +2 -2
  88. package/dist/index.d.ts +2 -2
  89. package/dist/index.js +47 -14
  90. package/dist/index.js.map +1 -1
  91. package/dist/index.mjs +58 -57
  92. package/dist/math/clamp.mjs +1 -1
  93. package/dist/math/inRange.mjs +1 -1
  94. package/dist/math/index.mjs +7 -7
  95. package/dist/math/mean.mjs +1 -1
  96. package/dist/math/meanBy.mjs +1 -1
  97. package/dist/math/random.mjs +1 -1
  98. package/dist/math/randomInt.mjs +1 -1
  99. package/dist/math/range.mjs +1 -1
  100. package/dist/math/round.mjs +1 -1
  101. package/dist/math/sum.mjs +1 -1
  102. package/dist/math/sumBy.mjs +1 -1
  103. package/dist/object/clone.mjs +1 -1
  104. package/dist/object/get.mjs +1 -1
  105. package/dist/object/index.mjs +5 -5
  106. package/dist/object/invert.mjs +1 -1
  107. package/dist/object/omit.mjs +2 -2
  108. package/dist/object/omitBy.mjs +1 -1
  109. package/dist/object/pick.mjs +1 -1
  110. package/dist/object/pickBy.mjs +1 -1
  111. package/dist/predicate/index.mjs +1 -1
  112. package/dist/predicate/isEqual.mjs +1 -1
  113. package/dist/predicate/isNil.mjs +1 -1
  114. package/dist/predicate/isNotNil.mjs +1 -1
  115. package/dist/predicate/isNull.mjs +1 -1
  116. package/dist/predicate/isUndefined.mjs +1 -1
  117. package/dist/promise/delay.mjs +1 -1
  118. package/dist/promise/index.d.mts +1 -0
  119. package/dist/promise/index.d.ts +1 -0
  120. package/dist/promise/index.js +47 -2
  121. package/dist/promise/index.js.map +1 -1
  122. package/dist/promise/index.mjs +9 -3
  123. package/dist/promise/timeout.d.mts +10 -0
  124. package/dist/promise/timeout.d.ts +10 -0
  125. package/dist/promise/timeout.js +92 -0
  126. package/dist/promise/timeout.js.map +1 -0
  127. package/dist/promise/timeout.mjs +11 -0
  128. package/dist/promise/withTimeout.d.mts +22 -0
  129. package/dist/promise/withTimeout.d.ts +22 -0
  130. package/dist/promise/withTimeout.js +99 -0
  131. package/dist/promise/withTimeout.js.map +1 -0
  132. package/dist/promise/withTimeout.mjs +12 -0
  133. package/dist/promise/withTimeout.mjs.map +1 -0
  134. package/dist/string/camelCase.mjs +1 -1
  135. package/dist/string/capitalize.mjs +1 -1
  136. package/dist/string/index.d.mts +0 -2
  137. package/dist/string/index.d.ts +0 -2
  138. package/dist/string/index.js +2 -16
  139. package/dist/string/index.js.map +1 -1
  140. package/dist/string/index.mjs +9 -17
  141. package/dist/string/kebabCase.mjs +1 -1
  142. package/dist/string/lowerCase.mjs +1 -1
  143. package/dist/string/snakeCase.mjs +1 -1
  144. package/dist/string/startCase.mjs +1 -1
  145. package/package.json +1 -1
  146. package/dist/chunk-ARZ5BDR6.mjs +0 -1
  147. package/dist/chunk-FZEZH22H.mjs +0 -1
  148. package/dist/chunk-SR5RPVRM.mjs +0 -9
  149. package/dist/chunk-SR5RPVRM.mjs.map +0 -1
  150. package/dist/chunk-YCTGSM4S.mjs +0 -1
  151. package/dist/chunk-ZFRI6VS4.mjs +0 -9
  152. package/dist/chunk-ZFRI6VS4.mjs.map +0 -1
  153. package/dist/string/endsWith.d.mts +0 -20
  154. package/dist/string/endsWith.d.ts +0 -20
  155. package/dist/string/endsWith.js +0 -33
  156. package/dist/string/endsWith.js.map +0 -1
  157. package/dist/string/endsWith.mjs +0 -8
  158. package/dist/string/startsWith.d.mts +0 -20
  159. package/dist/string/startsWith.d.ts +0 -20
  160. package/dist/string/startsWith.js.map +0 -1
  161. package/dist/string/startsWith.mjs +0 -8
  162. /package/dist/{chunk-2MM5EJJX.mjs.map → chunk-424M7IR7.mjs.map} +0 -0
  163. /package/dist/{chunk-ARZ5BDR6.mjs.map → chunk-4OIZM4HS.mjs.map} +0 -0
  164. /package/dist/{chunk-FZEZH22H.mjs.map → chunk-F47GLYUU.mjs.map} +0 -0
  165. /package/dist/{chunk-QZITBKWX.mjs.map → chunk-U7V3G7CR.mjs.map} +0 -0
  166. /package/dist/{chunk-YCTGSM4S.mjs.map → chunk-XT74R35S.mjs.map} +0 -0
  167. /package/dist/{string/endsWith.mjs.map → error/TimeoutError.mjs.map} +0 -0
  168. /package/dist/{string/startsWith.mjs.map → promise/timeout.mjs.map} +0 -0
@@ -1,30 +1,31 @@
1
1
  import "../chunk-NKLIE2OI.mjs";
2
- import "../chunk-ARZ5BDR6.mjs";
3
- import "../chunk-YCTGSM4S.mjs";
2
+ import "../chunk-4OIZM4HS.mjs";
3
+ import {
4
+ withTimeout
5
+ } from "../chunk-XWPCDIFC.mjs";
6
+ import "../chunk-J3GE7DEU.mjs";
7
+ import {
8
+ delay
9
+ } from "../chunk-O64NE2P4.mjs";
10
+ import "../chunk-XT74R35S.mjs";
11
+ import {
12
+ lowerCase
13
+ } from "../chunk-5IKVJGHO.mjs";
14
+ import {
15
+ snakeCase
16
+ } from "../chunk-F3WCQQET.mjs";
4
17
  import {
5
18
  startCase
6
19
  } from "../chunk-QXTNZR7B.mjs";
7
- import {
8
- startsWith
9
- } from "../chunk-SR5RPVRM.mjs";
10
20
  import {
11
21
  camelCase
12
22
  } from "../chunk-Y5V7UAZZ.mjs";
13
23
  import {
14
24
  capitalize
15
25
  } from "../chunk-U56ZOM7L.mjs";
16
- import {
17
- endsWith
18
- } from "../chunk-ZFRI6VS4.mjs";
19
26
  import {
20
27
  kebabCase
21
28
  } from "../chunk-EYYZQFOP.mjs";
22
- import {
23
- lowerCase
24
- } from "../chunk-5IKVJGHO.mjs";
25
- import {
26
- snakeCase
27
- } from "../chunk-F3WCQQET.mjs";
28
29
  import "../chunk-WVQ7YVRK.mjs";
29
30
  import "../chunk-ASJF5D6C.mjs";
30
31
  import {
@@ -42,10 +43,10 @@ import {
42
43
  import {
43
44
  isUndefined
44
45
  } from "../chunk-VH2PV426.mjs";
45
- import {
46
- delay
47
- } from "../chunk-O64NE2P4.mjs";
48
46
  import "../chunk-54TK5BIS.mjs";
47
+ import {
48
+ pick
49
+ } from "../chunk-HPFDYUGP.mjs";
49
50
  import {
50
51
  pickBy
51
52
  } from "../chunk-6CLH5YZ2.mjs";
@@ -60,39 +61,39 @@ import {
60
61
  } from "../chunk-OLX53VEF.mjs";
61
62
  import {
62
63
  omit
63
- } from "../chunk-QZITBKWX.mjs";
64
+ } from "../chunk-U7V3G7CR.mjs";
64
65
  import {
65
66
  omitBy
66
67
  } from "../chunk-BCTYOXT7.mjs";
67
- import {
68
- pick
69
- } from "../chunk-HPFDYUGP.mjs";
70
68
  import "../chunk-FUS75PJ7.mjs";
71
69
  import {
72
70
  sumBy
73
71
  } from "../chunk-5L4VWRFX.mjs";
72
+ import {
73
+ inRange
74
+ } from "../chunk-BH6HLGBA.mjs";
74
75
  import {
75
76
  meanBy
76
77
  } from "../chunk-MY4G7R3I.mjs";
77
78
  import {
78
79
  mean
79
80
  } from "../chunk-5ASRKEB4.mjs";
81
+ import {
82
+ sum
83
+ } from "../chunk-2SLTL4KL.mjs";
80
84
  import {
81
85
  range
82
86
  } from "../chunk-DPH2KE6O.mjs";
83
87
  import {
84
88
  round
85
89
  } from "../chunk-5PMKOZ2F.mjs";
86
- import {
87
- sum
88
- } from "../chunk-2SLTL4KL.mjs";
89
90
  import {
90
91
  clamp
91
92
  } from "../chunk-MLCL773E.mjs";
92
- import {
93
- inRange
94
- } from "../chunk-BH6HLGBA.mjs";
95
93
  import "../chunk-DDH7K4QM.mjs";
94
+ import {
95
+ without
96
+ } from "../chunk-PYEYV7BY.mjs";
96
97
  import {
97
98
  xor
98
99
  } from "../chunk-L7FQX5MN.mjs";
@@ -111,12 +112,18 @@ import {
111
112
  import {
112
113
  zipWith
113
114
  } from "../chunk-4KYXHZ4R.mjs";
115
+ import {
116
+ union
117
+ } from "../chunk-R6QA7PLZ.mjs";
114
118
  import {
115
119
  unionBy
116
120
  } from "../chunk-NFS7RWWE.mjs";
117
121
  import {
118
122
  unionWith
119
123
  } from "../chunk-2ZCITDMK.mjs";
124
+ import {
125
+ uniq
126
+ } from "../chunk-DVK2N4KC.mjs";
120
127
  import {
121
128
  uniqBy
122
129
  } from "../chunk-B4COTK4K.mjs";
@@ -130,8 +137,14 @@ import {
130
137
  unzipWith
131
138
  } from "../chunk-IFNXROZR.mjs";
132
139
  import {
133
- without
134
- } from "../chunk-PYEYV7BY.mjs";
140
+ sampleSize
141
+ } from "../chunk-EHSKB6DF.mjs";
142
+ import {
143
+ randomInt
144
+ } from "../chunk-GIWAOOFY.mjs";
145
+ import {
146
+ random
147
+ } from "../chunk-SYWMYQYJ.mjs";
135
148
  import {
136
149
  shuffle
137
150
  } from "../chunk-G7UQ5PUR.mjs";
@@ -154,11 +167,8 @@ import {
154
167
  toFilled
155
168
  } from "../chunk-OP4OAKQJ.mjs";
156
169
  import {
157
- union
158
- } from "../chunk-R6QA7PLZ.mjs";
159
- import {
160
- uniq
161
- } from "../chunk-DVK2N4KC.mjs";
170
+ intersectionWith
171
+ } from "../chunk-XI7KRD2C.mjs";
162
172
  import {
163
173
  keyBy
164
174
  } from "../chunk-AJKZMN2V.mjs";
@@ -181,14 +191,8 @@ import {
181
191
  sample
182
192
  } from "../chunk-2KNLZB7V.mjs";
183
193
  import {
184
- sampleSize
185
- } from "../chunk-EHSKB6DF.mjs";
186
- import {
187
- randomInt
188
- } from "../chunk-GIWAOOFY.mjs";
189
- import {
190
- random
191
- } from "../chunk-SYWMYQYJ.mjs";
194
+ flattenDeep
195
+ } from "../chunk-ML727RRJ.mjs";
192
196
  import {
193
197
  forEachRight
194
198
  } from "../chunk-IEA53J7P.mjs";
@@ -208,8 +212,8 @@ import {
208
212
  intersectionBy
209
213
  } from "../chunk-O6UXZR3U.mjs";
210
214
  import {
211
- intersectionWith
212
- } from "../chunk-XI7KRD2C.mjs";
215
+ differenceWith
216
+ } from "../chunk-6NVQAHXP.mjs";
213
217
  import {
214
218
  drop
215
219
  } from "../chunk-S3CORED5.mjs";
@@ -228,9 +232,6 @@ import {
228
232
  import {
229
233
  flatMap
230
234
  } from "../chunk-UY76KTPE.mjs";
231
- import {
232
- flattenDeep
233
- } from "../chunk-ML727RRJ.mjs";
234
235
  import {
235
236
  flatten
236
237
  } from "../chunk-33MSBDC6.mjs";
@@ -249,14 +250,17 @@ import {
249
250
  import {
250
251
  differenceBy
251
252
  } from "../chunk-LVWX5B43.mjs";
252
- import {
253
- differenceWith
254
- } from "../chunk-6NVQAHXP.mjs";
255
- import "../chunk-FZEZH22H.mjs";
253
+ import "../chunk-F47GLYUU.mjs";
256
254
  import {
257
255
  AbortError
258
256
  } from "../chunk-DXB7EZUQ.mjs";
257
+ import {
258
+ TimeoutError
259
+ } from "../chunk-KIOYQRMQ.mjs";
259
260
  import "../chunk-236H5JZJ.mjs";
261
+ import {
262
+ noop
263
+ } from "../chunk-LKXCOLNY.mjs";
260
264
  import {
261
265
  once
262
266
  } from "../chunk-CMBC4MXG.mjs";
@@ -269,10 +273,7 @@ import {
269
273
  import {
270
274
  negate
271
275
  } from "../chunk-BOOQBJN2.mjs";
272
- import {
273
- noop
274
- } from "../chunk-LKXCOLNY.mjs";
275
- import "../chunk-2MM5EJJX.mjs";
276
+ import "../chunk-424M7IR7.mjs";
276
277
 
277
278
  // src/compat/array/chunk.ts
278
279
  function chunk2(arr, size = 1) {
@@ -353,8 +354,19 @@ function zipObjectDeep(keys, values) {
353
354
  }
354
355
  return result;
355
356
  }
357
+
358
+ // src/compat/string/startsWith.ts
359
+ var startsWith = (str, target, position = 0) => {
360
+ return str.startsWith(target, position);
361
+ };
362
+
363
+ // src/compat/string/endsWith.ts
364
+ var endsWith = (str, target, position = str.length) => {
365
+ return str.endsWith(target, position);
366
+ };
356
367
  export {
357
368
  AbortError,
369
+ TimeoutError,
358
370
  camelCase,
359
371
  capitalize,
360
372
  chunk2 as chunk,
@@ -436,6 +448,7 @@ export {
436
448
  uniqWith,
437
449
  unzip,
438
450
  unzipWith,
451
+ withTimeout,
439
452
  without,
440
453
  xor,
441
454
  xorBy,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/compat/array/chunk.ts","../../src/compat/_internal/isIndex.ts","../../src/compat/_internal/toPath.ts","../../src/compat/object/set.ts","../../src/compat/array/zipObjectDeep.ts"],"sourcesContent":["import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size: number = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n","const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/\n\nexport function isIndex(value: PropertyKey) {\n switch (typeof value) {\n case 'number': {\n return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;\n }\n case 'symbol': {\n return false;\n }\n case 'string': {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\n}","const ESCAPE_REGEXP = /\\\\(\\\\)?/g;\nconst PROPERTY_REGEXP = RegExp(\n // Match anything that isn't a dot or bracket.\n \"[^.[\\\\]]+\" +\n \"|\" +\n // Or match property names within brackets.\n \"\\\\[(?:\" +\n // Match a non-string expression.\n \"([^\\\"'][^[]*)\" +\n \"|\" +\n // Or match strings (supports escaping characters).\n \"([\\\"'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2\" +\n \")\\\\]\" +\n \"|\" +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n \"(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))\",\n \"g\",\n);\n\n/**\n * Converts a deep key string into an array of path segments.\n *\n * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n *\n * @param deepKey - The deep key string to convert.\n * @returns An array of strings, each representing a segment of the path.\n *\n * Examples:\n *\n * toPath('a.b.c') // Returns ['a', 'b', 'c']\n * toPath('a[b][c]') // Returns ['a', 'b', 'c']\n * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n * toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n * toPath('') // Returns []\n * toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n */\nexport function toPath(deepKey: string): string[] {\n const result: string[] = [];\n\n if (deepKey[0] === \".\") {\n result.push(\"\");\n }\n\n let match: RegExpExecArray | null;\n\n while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {\n let [key, expr, quote, substr] = match;\n\n if (quote) {\n key = substr.replace(ESCAPE_REGEXP, \"$1\");\n } else if (expr) {\n key = expr.trim();\n }\n\n result.push(key);\n }\n\n return result;\n}\n","import { isIndex } from \"../_internal/isIndex.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\n\n/**\n * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n *\n * @template T - The type of the object.\n * @param {Settable} obj - The object to modify.\n * @param {Path} path - The path of the property to set.\n * @param {any} value - The value to set.\n * @returns {T} - The modified object.\n *\n * @example\n * // Set a value in a nested object\n * const obj = { a: { b: { c: 3 } } };\n * set(obj, 'a.b.c', 4);\n * console.log(obj.a.b.c); // 4\n *\n * @example\n * // Set a value in an array\n * const arr = [1, 2, 3];\n * set(arr, 1, 4);\n * console.log(arr[1]); // 4\n *\n * @example\n * // Create non-existent path and set value\n * const obj = {};\n * set(obj, 'a.b.c', 4);\n * console.log(obj); // { a: { b: { c: 4 } } }\n */\nexport function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;\nexport function set<T extends object>(obj: T, path: PropertyKey | readonly PropertyKey[], value: unknown): T {\n const resolvedPath = Array.isArray(path)\n ? path\n : typeof path === 'string'\n ? toPath(path)\n : [path];\n\n let current: any = obj;\n\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] == null) {\n current[key] = isIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath[resolvedPath.length - 1];\n current[lastKey] = value;\n\n return obj;\n}\n","import { zip } from \"../../array/zip.ts\";\nimport { set } from \"../object/set.ts\";\n\n/**\n * Creates a deeply nested object given arrays of paths and values.\n *\n * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.\n * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.\n * Paths can be dot-separated strings or arrays of property names.\n * \n * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.\n *\n * @template V - The type of elements in the array.\n * @param {string[] | string[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.\n * @param {V[]} values - An array of values corresponding to the property paths.\n * @returns {object} A new object composed of the given property paths and values.\n *\n * @example\n * const paths = ['a.b.c', 'd.e.f'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n *\n * @example\n * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n * \n * @example\n * const paths = ['a.b[0].c', 'a.b[1].d'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\nexport function zipObjectDeep<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n const zipped = zip(keys, values);\n\n for (let i = 0; i < zipped.length; i++) {\n const [key, value] = zipped[i];\n\n if (key != null) {\n set(result, key, value);\n }\n }\n\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBO,SAASA,OAAS,KAAmB,OAAe,GAAU;AACnE,SAAO,KAAK,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC;AAEnC,MAAI,SAAS,GAAG;AACd,WAAO,CAAC;AAAA,EACV;AAEA,SAAO,MAAa,KAAK,IAAI;AAC/B;;;ACjCA,IAAM,sBAAsB;AAErB,SAAS,QAAQ,OAAoB;AAC1C,UAAQ,OAAO,OAAO;AAAA,IACpB,KAAK,UAAU;AACb,aAAO,OAAO,UAAU,KAAK,KAAK,SAAS,KAAK,QAAQ,OAAO;AAAA,IACjE;AAAA,IACA,KAAK,UAAU;AACb,aAAO;AAAA,IACT;AAAA,IACA,KAAK,UAAU;AACb,aAAO,oBAAoB,KAAK,KAAK;AAAA,IACvC;AAAA,EACF;AACF;;;ACdA,IA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,KAAK,KAAK;AAAA,IACxB;AAAA,EACF;AAEA,SAAO;AACT;","names":["chunk"]}
1
+ {"version":3,"sources":["../../src/compat/array/chunk.ts","../../src/compat/_internal/isIndex.ts","../../src/compat/_internal/toPath.ts","../../src/compat/object/set.ts","../../src/compat/array/zipObjectDeep.ts","../../src/compat/string/startsWith.ts","../../src/compat/string/endsWith.ts"],"sourcesContent":["import { chunk as chunkToolkit } from '../../array/chunk.ts';\n\n/**\n * Splits an array into smaller arrays of a specified length.\n *\n * This function takes an input array and divides it into multiple smaller arrays,\n * each of a specified length. If the input array cannot be evenly divided,\n * the final sub-array will contain the remaining elements.\n *\n * @template T The type of elements in the array.\n * @param {T[]} arr - The array to be chunked into smaller arrays.\n * @param {number} size - The size of each smaller array. Must be a positive integer.\n * @returns {T[][]} A two-dimensional array where each sub-array has a maximum length of `size`.\n * @throws {Error} Throws an error if `size` is not a positive integer.\n *\n * @example\n * // Splits an array of numbers into sub-arrays of length 2\n * chunk([1, 2, 3, 4, 5], 2);\n * // Returns: [[1, 2], [3, 4], [5]]\n *\n * @example\n * // Splits an array of strings into sub-arrays of length 3\n * chunk(['a', 'b', 'c', 'd', 'e', 'f', 'g'], 3);\n * // Returns: [['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]\n */\nexport function chunk<T>(arr: readonly T[], size: number = 1): T[][] {\n size = Math.max(Math.floor(size), 0);\n\n if (size === 0) {\n return [];\n }\n\n return chunkToolkit(arr, size);\n}\n","const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\\d*)$/\n\nexport function isIndex(value: PropertyKey) {\n switch (typeof value) {\n case 'number': {\n return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;\n }\n case 'symbol': {\n return false;\n }\n case 'string': {\n return IS_UNSIGNED_INTEGER.test(value);\n }\n }\n}","const ESCAPE_REGEXP = /\\\\(\\\\)?/g;\nconst PROPERTY_REGEXP = RegExp(\n // Match anything that isn't a dot or bracket.\n \"[^.[\\\\]]+\" +\n \"|\" +\n // Or match property names within brackets.\n \"\\\\[(?:\" +\n // Match a non-string expression.\n \"([^\\\"'][^[]*)\" +\n \"|\" +\n // Or match strings (supports escaping characters).\n \"([\\\"'])((?:(?!\\\\2)[^\\\\\\\\]|\\\\\\\\.)*?)\\\\2\" +\n \")\\\\]\" +\n \"|\" +\n // Or match \"\" as the space between consecutive dots or empty brackets.\n \"(?=(?:\\\\.|\\\\[\\\\])(?:\\\\.|\\\\[\\\\]|$))\",\n \"g\",\n);\n\n/**\n * Converts a deep key string into an array of path segments.\n *\n * This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.\n *\n * @param deepKey - The deep key string to convert.\n * @returns An array of strings, each representing a segment of the path.\n *\n * Examples:\n *\n * toPath('a.b.c') // Returns ['a', 'b', 'c']\n * toPath('a[b][c]') // Returns ['a', 'b', 'c']\n * toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']\n * toPath('a[\"b.c\"].d') // Returns ['a', 'b.c', 'd']\n * toPath('') // Returns []\n * toPath('.a[b].c.d[e][\"f.g\"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']\n */\nexport function toPath(deepKey: string): string[] {\n const result: string[] = [];\n\n if (deepKey[0] === \".\") {\n result.push(\"\");\n }\n\n let match: RegExpExecArray | null;\n\n while ((match = PROPERTY_REGEXP.exec(deepKey)) !== null) {\n let [key, expr, quote, substr] = match;\n\n if (quote) {\n key = substr.replace(ESCAPE_REGEXP, \"$1\");\n } else if (expr) {\n key = expr.trim();\n }\n\n result.push(key);\n }\n\n return result;\n}\n","import { isIndex } from \"../_internal/isIndex.ts\";\nimport { toPath } from \"../_internal/toPath.ts\";\n\n/**\n * Sets the value at the specified path of the given object. If any part of the path does not exist, it will be created.\n *\n * @template T - The type of the object.\n * @param {Settable} obj - The object to modify.\n * @param {Path} path - The path of the property to set.\n * @param {any} value - The value to set.\n * @returns {T} - The modified object.\n *\n * @example\n * // Set a value in a nested object\n * const obj = { a: { b: { c: 3 } } };\n * set(obj, 'a.b.c', 4);\n * console.log(obj.a.b.c); // 4\n *\n * @example\n * // Set a value in an array\n * const arr = [1, 2, 3];\n * set(arr, 1, 4);\n * console.log(arr[1]); // 4\n *\n * @example\n * // Create non-existent path and set value\n * const obj = {};\n * set(obj, 'a.b.c', 4);\n * console.log(obj); // { a: { b: { c: 4 } } }\n */\nexport function set<T>(obj: object, path: PropertyKey | readonly PropertyKey[], value: unknown): T;\nexport function set<T extends object>(obj: T, path: PropertyKey | readonly PropertyKey[], value: unknown): T {\n const resolvedPath = Array.isArray(path)\n ? path\n : typeof path === 'string'\n ? toPath(path)\n : [path];\n\n let current: any = obj;\n\n for (let i = 0; i < resolvedPath.length - 1; i++) {\n const key = resolvedPath[i];\n const nextKey = resolvedPath[i + 1];\n\n if (current[key] == null) {\n current[key] = isIndex(nextKey) ? [] : {};\n }\n\n current = current[key];\n }\n\n const lastKey = resolvedPath[resolvedPath.length - 1];\n current[lastKey] = value;\n\n return obj;\n}\n","import { zip } from \"../../array/zip.ts\";\nimport { set } from \"../object/set.ts\";\n\n/**\n * Creates a deeply nested object given arrays of paths and values.\n *\n * This function takes two arrays: one containing arrays of property paths, and the other containing corresponding values.\n * It returns a new object where paths from the first array are used as key paths to set values, with corresponding elements from the second array as values.\n * Paths can be dot-separated strings or arrays of property names.\n * \n * If the `keys` array is longer than the `values` array, the remaining keys will have `undefined` as their values.\n *\n * @template V - The type of elements in the array.\n * @param {string[] | string[][]} keys - An array of property paths, each path can be a dot-separated string or an array of property names.\n * @param {V[]} values - An array of values corresponding to the property paths.\n * @returns {object} A new object composed of the given property paths and values.\n *\n * @example\n * const paths = ['a.b.c', 'd.e.f'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n *\n * @example\n * const paths = [['a', 'b', 'c'], ['d', 'e', 'f']];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { a: { b: { c: 1 } }, d: { e: { f: 2 } } }\n * \n * @example\n * const paths = ['a.b[0].c', 'a.b[1].d'];\n * const values = [1, 2];\n * const result = zipObjectDeep(paths, values);\n * // result will be { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }\n */\nexport function zipObjectDeep<P extends string | number | symbol, V>(keys: P[], values: V[]): { [K in P]: V } {\n const result = {} as { [K in P]: V };\n const zipped = zip(keys, values);\n\n for (let i = 0; i < zipped.length; i++) {\n const [key, value] = zipped[i];\n\n if (key != null) {\n set(result, key, value);\n }\n }\n\n return result;\n}\n","/**\n * Checks if a string contains another string at the beginning of the string.\n *\n * Checks if one string startsWith another string. Optional position parameter to start searching from a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional offset to start searching in the str string\n * @returns {boolean} - True if the str string starts with the target string.\n *\n * @example\n * const isPrefix = startsWith('fooBar', 'foo') // returns true\n * const isPrefix = startsWith('fooBar', 'bar') // returns false\n * const isPrefix = startsWith('fooBar', 'abc') // returns false\n * const isPrefix = startsWith('fooBar', 'Bar', 2) // returns true\n * const isPrefix = startsWith('fooBar', 'Bar', 5) // returns false\n */\nexport const startsWith = (str: string, target: string, position: number = 0): boolean => {\n return str.startsWith(target, position);\n};\n","/**\n * Checks if a string contains another string at the end of the string.\n *\n * Checks if one string endsWith another string. Optional position parameter to offset searching before a certain index.\n *\n * @param {string} str - The string that might contain the target string.\n * @param {string} target - The string to search for.\n * @param {number} position - An optional position from the start to search up to this index\n * @returns {boolean} - True if the str string ends with the target string.\n *\n * @example\n * const isPrefix = endsWith('fooBar', 'foo') // returns true\n * const isPrefix = endsWith('fooBar', 'bar') // returns false\n * const isPrefix = endsWith('fooBar', 'abc') // returns false\n * const isPrefix = endsWith('fooBar', 'foo', 3) // returns true\n * const isPrefix = endsWith('fooBar', 'abc', 5) // returns false\n */\nexport const endsWith = (str: string, target: string, position: number = str.length): boolean => {\n return str.endsWith(target, position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M7IR7.mjs";
5
5
  export {
6
6
  AbortError
7
7
  };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * An error class representing an timeout operation.
3
+ * @augments Error
4
+ */
5
+ declare class TimeoutError extends Error {
6
+ constructor(message?: string);
7
+ }
8
+
9
+ export { TimeoutError };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * An error class representing an timeout operation.
3
+ * @augments Error
4
+ */
5
+ declare class TimeoutError extends Error {
6
+ constructor(message?: string);
7
+ }
8
+
9
+ export { TimeoutError };
@@ -17,17 +17,20 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/string/startsWith.ts
21
- var startsWith_exports = {};
22
- __export(startsWith_exports, {
23
- startsWith: () => startsWith
20
+ // src/error/TimeoutError.ts
21
+ var TimeoutError_exports = {};
22
+ __export(TimeoutError_exports, {
23
+ TimeoutError: () => TimeoutError
24
24
  });
25
- module.exports = __toCommonJS(startsWith_exports);
26
- var startsWith = (str, target, position = 0) => {
27
- return str.startsWith(target, position);
25
+ module.exports = __toCommonJS(TimeoutError_exports);
26
+ var TimeoutError = class extends Error {
27
+ constructor(message = "The operation was timed out") {
28
+ super(message);
29
+ this.name = "TimeoutError";
30
+ }
28
31
  };
29
32
  // Annotate the CommonJS export names for ESM import in node:
30
33
  0 && (module.exports = {
31
- startsWith
34
+ TimeoutError
32
35
  });
33
- //# sourceMappingURL=startsWith.js.map
36
+ //# sourceMappingURL=TimeoutError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/error/TimeoutError.ts"],"sourcesContent":["/**\n * An error class representing an timeout operation.\n * @augments Error\n */\nexport class TimeoutError extends Error {\n constructor(message = 'The operation was timed out') {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,UAAU,+BAA+B;AACnD,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ TimeoutError
3
+ } from "../chunk-KIOYQRMQ.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
+ export {
6
+ TimeoutError
7
+ };
8
+ //# sourceMappingURL=TimeoutError.mjs.map
@@ -1 +1,2 @@
1
1
  export { AbortError } from './AbortError.mjs';
2
+ export { TimeoutError } from './TimeoutError.mjs';
@@ -1 +1,2 @@
1
1
  export { AbortError } from './AbortError.js';
2
+ export { TimeoutError } from './TimeoutError.js';
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/error/index.ts
21
21
  var error_exports = {};
22
22
  __export(error_exports, {
23
- AbortError: () => AbortError
23
+ AbortError: () => AbortError,
24
+ TimeoutError: () => TimeoutError
24
25
  });
25
26
  module.exports = __toCommonJS(error_exports);
26
27
 
@@ -31,8 +32,17 @@ var AbortError = class extends Error {
31
32
  this.name = "AbortError";
32
33
  }
33
34
  };
35
+
36
+ // src/error/TimeoutError.ts
37
+ var TimeoutError = class extends Error {
38
+ constructor(message = "The operation was timed out") {
39
+ super(message);
40
+ this.name = "TimeoutError";
41
+ }
42
+ };
34
43
  // Annotate the CommonJS export names for ESM import in node:
35
44
  0 && (module.exports = {
36
- AbortError
45
+ AbortError,
46
+ TimeoutError
37
47
  });
38
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/error/index.ts","../../src/error/AbortError.ts"],"sourcesContent":["export { AbortError } from './AbortError.ts';\n","/**\n * An error class representing an aborted operation.\n * @augments Error\n */\nexport class AbortError extends Error {\n constructor(message = 'The operation was aborted') {\n super(message);\n this.name = 'AbortError';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,IAAM,aAAN,cAAyB,MAAM;AAAA,EACpC,YAAY,UAAU,6BAA6B;AACjD,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/error/index.ts","../../src/error/AbortError.ts","../../src/error/TimeoutError.ts"],"sourcesContent":["export { AbortError } from './AbortError.ts';\nexport { TimeoutError } from './TimeoutError.ts';\n","/**\n * An error class representing an aborted operation.\n * @augments Error\n */\nexport class AbortError extends Error {\n constructor(message = 'The operation was aborted') {\n super(message);\n this.name = 'AbortError';\n }\n}\n","/**\n * An error class representing an timeout operation.\n * @augments Error\n */\nexport class TimeoutError extends Error {\n constructor(message = 'The operation was timed out') {\n super(message);\n this.name = 'TimeoutError';\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,IAAM,aAAN,cAAyB,MAAM;AAAA,EACpC,YAAY,UAAU,6BAA6B;AACjD,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;;;ACLO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,UAAU,+BAA+B;AACnD,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;","names":[]}
@@ -1,9 +1,13 @@
1
- import "../chunk-FZEZH22H.mjs";
1
+ import "../chunk-F47GLYUU.mjs";
2
2
  import {
3
3
  AbortError
4
4
  } from "../chunk-DXB7EZUQ.mjs";
5
- import "../chunk-2MM5EJJX.mjs";
5
+ import {
6
+ TimeoutError
7
+ } from "../chunk-KIOYQRMQ.mjs";
8
+ import "../chunk-424M7IR7.mjs";
6
9
  export {
7
- AbortError
10
+ AbortError,
11
+ TimeoutError
8
12
  };
9
13
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  debounce
3
3
  } from "../chunk-3IP4JVLL.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  debounce
7
7
  };
@@ -1,4 +1,7 @@
1
1
  import "../chunk-236H5JZJ.mjs";
2
+ import {
3
+ noop
4
+ } from "../chunk-LKXCOLNY.mjs";
2
5
  import {
3
6
  once
4
7
  } from "../chunk-CMBC4MXG.mjs";
@@ -11,10 +14,7 @@ import {
11
14
  import {
12
15
  negate
13
16
  } from "../chunk-BOOQBJN2.mjs";
14
- import {
15
- noop
16
- } from "../chunk-LKXCOLNY.mjs";
17
- import "../chunk-2MM5EJJX.mjs";
17
+ import "../chunk-424M7IR7.mjs";
18
18
  export {
19
19
  debounce,
20
20
  negate,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  negate
3
3
  } from "../chunk-BOOQBJN2.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  negate
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  noop
3
3
  } from "../chunk-LKXCOLNY.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  noop
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  once
3
3
  } from "../chunk-CMBC4MXG.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  once
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  throttle
3
3
  } from "../chunk-QOJGMVVR.mjs";
4
- import "../chunk-2MM5EJJX.mjs";
4
+ import "../chunk-424M7IR7.mjs";
5
5
  export {
6
6
  throttle
7
7
  };
package/dist/index.d.mts CHANGED
@@ -50,6 +50,7 @@ export { toFilled } from './array/toFilled.mjs';
50
50
  export { last } from './array/last.mjs';
51
51
  export { initial } from './array/initial.mjs';
52
52
  export { AbortError } from './error/AbortError.mjs';
53
+ export { TimeoutError } from './error/TimeoutError.mjs';
53
54
  export { debounce } from './function/debounce.mjs';
54
55
  export { noop } from './function/noop.mjs';
55
56
  export { once } from './function/once.mjs';
@@ -78,11 +79,10 @@ export { isNotNil } from './predicate/isNotNil.mjs';
78
79
  export { isNull } from './predicate/isNull.mjs';
79
80
  export { isUndefined } from './predicate/isUndefined.mjs';
80
81
  export { delay } from './promise/delay.mjs';
82
+ export { withTimeout } from './promise/withTimeout.mjs';
81
83
  export { camelCase } from './string/camelCase.mjs';
82
84
  export { snakeCase } from './string/snakeCase.mjs';
83
85
  export { kebabCase } from './string/kebabCase.mjs';
84
86
  export { lowerCase } from './string/lowerCase.mjs';
85
87
  export { startCase } from './string/startCase.mjs';
86
- export { startsWith } from './string/startsWith.mjs';
87
- export { endsWith } from './string/endsWith.mjs';
88
88
  export { capitalize } from './string/capitalize.mjs';
package/dist/index.d.ts CHANGED
@@ -50,6 +50,7 @@ export { toFilled } from './array/toFilled.js';
50
50
  export { last } from './array/last.js';
51
51
  export { initial } from './array/initial.js';
52
52
  export { AbortError } from './error/AbortError.js';
53
+ export { TimeoutError } from './error/TimeoutError.js';
53
54
  export { debounce } from './function/debounce.js';
54
55
  export { noop } from './function/noop.js';
55
56
  export { once } from './function/once.js';
@@ -78,11 +79,10 @@ export { isNotNil } from './predicate/isNotNil.js';
78
79
  export { isNull } from './predicate/isNull.js';
79
80
  export { isUndefined } from './predicate/isUndefined.js';
80
81
  export { delay } from './promise/delay.js';
82
+ export { withTimeout } from './promise/withTimeout.js';
81
83
  export { camelCase } from './string/camelCase.js';
82
84
  export { snakeCase } from './string/snakeCase.js';
83
85
  export { kebabCase } from './string/kebabCase.js';
84
86
  export { lowerCase } from './string/lowerCase.js';
85
87
  export { startCase } from './string/startCase.js';
86
- export { startsWith } from './string/startsWith.js';
87
- export { endsWith } from './string/endsWith.js';
88
88
  export { capitalize } from './string/capitalize.js';