@ts-fns/stdlib 0.1.0 → 0.2.1

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 (135) hide show
  1. package/dist/array/index.cjs +239 -37
  2. package/dist/array/index.cjs.map +1 -1
  3. package/dist/array/index.d.cts +437 -36
  4. package/dist/array/index.d.cts.map +1 -1
  5. package/dist/array/index.d.mts +437 -36
  6. package/dist/array/index.d.mts.map +1 -1
  7. package/dist/array/index.mjs +225 -22
  8. package/dist/array/index.mjs.map +1 -1
  9. package/dist/function/index.cjs +4 -2
  10. package/dist/function/index.d.cts +128 -13
  11. package/dist/function/index.d.cts.map +1 -1
  12. package/dist/function/index.d.mts +128 -13
  13. package/dist/function/index.d.mts.map +1 -1
  14. package/dist/function/index.mjs +3 -3
  15. package/dist/{function-DnI2v0p3.mjs → function-CYHPhQCQ.mjs} +84 -6
  16. package/dist/function-CYHPhQCQ.mjs.map +1 -0
  17. package/dist/{function-CB82a2GS.cjs → function-DYPifnmg.cjs} +95 -5
  18. package/dist/function-DYPifnmg.cjs.map +1 -0
  19. package/dist/{get-yrs1Kqho.cjs → get-1kqkxPFX.cjs} +20 -8
  20. package/dist/get-1kqkxPFX.cjs.map +1 -0
  21. package/dist/{get-CWL_cu6G.mjs → get-Dv6ejLZg.mjs} +21 -3
  22. package/dist/get-Dv6ejLZg.mjs.map +1 -0
  23. package/dist/guard/index.cjs +5 -12
  24. package/dist/guard/index.cjs.map +1 -1
  25. package/dist/guard/index.d.cts +18 -17
  26. package/dist/guard/index.d.cts.map +1 -1
  27. package/dist/guard/index.d.mts +18 -17
  28. package/dist/guard/index.d.mts.map +1 -1
  29. package/dist/guard/index.mjs +4 -12
  30. package/dist/guard/index.mjs.map +1 -1
  31. package/dist/index-MbdqaUt1.d.cts +54 -0
  32. package/dist/index-MbdqaUt1.d.cts.map +1 -0
  33. package/dist/index-k-paNOu4.d.mts +54 -0
  34. package/dist/index-k-paNOu4.d.mts.map +1 -0
  35. package/dist/iterator/index.cjs +72 -26
  36. package/dist/iterator/index.cjs.map +1 -1
  37. package/dist/iterator/index.d.cts +157 -5
  38. package/dist/iterator/index.d.cts.map +1 -1
  39. package/dist/iterator/index.d.mts +157 -5
  40. package/dist/iterator/index.d.mts.map +1 -1
  41. package/dist/iterator/index.mjs +66 -24
  42. package/dist/iterator/index.mjs.map +1 -1
  43. package/dist/lens/index.cjs +3 -3
  44. package/dist/lens/index.cjs.map +1 -1
  45. package/dist/lens/index.mjs +3 -3
  46. package/dist/lens/index.mjs.map +1 -1
  47. package/dist/map/index.cjs +88 -1
  48. package/dist/map/index.cjs.map +1 -1
  49. package/dist/map/index.d.cts +130 -2
  50. package/dist/map/index.d.cts.map +1 -1
  51. package/dist/map/index.d.mts +130 -2
  52. package/dist/map/index.d.mts.map +1 -1
  53. package/dist/map/index.mjs +86 -2
  54. package/dist/map/index.mjs.map +1 -1
  55. package/dist/number/index.cjs +91 -18
  56. package/dist/number/index.cjs.map +1 -1
  57. package/dist/number/index.d.cts +134 -19
  58. package/dist/number/index.d.cts.map +1 -1
  59. package/dist/number/index.d.mts +134 -19
  60. package/dist/number/index.d.mts.map +1 -1
  61. package/dist/number/index.mjs +91 -18
  62. package/dist/number/index.mjs.map +1 -1
  63. package/dist/object/index.cjs +111 -7
  64. package/dist/object/index.cjs.map +1 -1
  65. package/dist/object/index.d.cts +186 -26
  66. package/dist/object/index.d.cts.map +1 -1
  67. package/dist/object/index.d.mts +186 -26
  68. package/dist/object/index.d.mts.map +1 -1
  69. package/dist/object/index.mjs +111 -7
  70. package/dist/object/index.mjs.map +1 -1
  71. package/dist/orNull-CJNrTjhQ.cjs +45 -0
  72. package/dist/orNull-CJNrTjhQ.cjs.map +1 -0
  73. package/dist/orNull-EeXiCxD4.mjs +34 -0
  74. package/dist/orNull-EeXiCxD4.mjs.map +1 -0
  75. package/dist/order/index.cjs +22 -1
  76. package/dist/order/index.cjs.map +1 -1
  77. package/dist/order/index.d.cts +2 -2
  78. package/dist/order/index.d.mts +2 -2
  79. package/dist/order/index.mjs +22 -1
  80. package/dist/order/index.mjs.map +1 -1
  81. package/dist/{order.constants-BWSCg3C7.d.cts → order.constants-DpGY-EDp.d.cts} +4 -1
  82. package/dist/order.constants-DpGY-EDp.d.cts.map +1 -0
  83. package/dist/{order.constants-BWSCg3C7.d.mts → order.constants-DpGY-EDp.d.mts} +4 -1
  84. package/dist/order.constants-DpGY-EDp.d.mts.map +1 -0
  85. package/dist/purry-DXnhXie9.mjs +22 -0
  86. package/dist/purry-DXnhXie9.mjs.map +1 -0
  87. package/dist/purry-Dqp_F64t.cjs +27 -0
  88. package/dist/purry-Dqp_F64t.cjs.map +1 -0
  89. package/dist/set/index.cjs +59 -1
  90. package/dist/set/index.cjs.map +1 -1
  91. package/dist/set/index.d.cts +151 -2
  92. package/dist/set/index.d.cts.map +1 -1
  93. package/dist/set/index.d.mts +151 -2
  94. package/dist/set/index.d.mts.map +1 -1
  95. package/dist/set/index.mjs +59 -2
  96. package/dist/set/index.mjs.map +1 -1
  97. package/dist/string/index.cjs +289 -15
  98. package/dist/string/index.cjs.map +1 -1
  99. package/dist/string/index.d.cts +406 -1
  100. package/dist/string/index.d.cts.map +1 -1
  101. package/dist/string/index.d.mts +406 -1
  102. package/dist/string/index.d.mts.map +1 -1
  103. package/dist/string/index.mjs +271 -4
  104. package/dist/string/index.mjs.map +1 -1
  105. package/dist/tuple/index.cjs +20 -21
  106. package/dist/tuple/index.cjs.map +1 -1
  107. package/dist/tuple/index.d.cts +27 -58
  108. package/dist/tuple/index.d.cts.map +1 -1
  109. package/dist/tuple/index.d.mts +27 -58
  110. package/dist/tuple/index.d.mts.map +1 -1
  111. package/dist/tuple/index.mjs +20 -22
  112. package/dist/tuple/index.mjs.map +1 -1
  113. package/package.json +55 -127
  114. package/dist/function-CB82a2GS.cjs.map +0 -1
  115. package/dist/function-DnI2v0p3.mjs.map +0 -1
  116. package/dist/get-CWL_cu6G.mjs.map +0 -1
  117. package/dist/get-yrs1Kqho.cjs.map +0 -1
  118. package/dist/index-BJlKyBJH.d.cts +0 -18
  119. package/dist/index-BJlKyBJH.d.cts.map +0 -1
  120. package/dist/index-DGrnGMDt.d.mts +0 -18
  121. package/dist/index-DGrnGMDt.d.mts.map +0 -1
  122. package/dist/isNotNil-DrF-ohem.cjs +0 -28
  123. package/dist/isNotNil-DrF-ohem.cjs.map +0 -1
  124. package/dist/isNotNil-R5f1hC53.mjs +0 -23
  125. package/dist/isNotNil-R5f1hC53.mjs.map +0 -1
  126. package/dist/orThrow-V91Jw2lF.mjs +0 -15
  127. package/dist/orThrow-V91Jw2lF.mjs.map +0 -1
  128. package/dist/orThrow-ejzcQYAI.cjs +0 -20
  129. package/dist/orThrow-ejzcQYAI.cjs.map +0 -1
  130. package/dist/order.constants-BWSCg3C7.d.cts.map +0 -1
  131. package/dist/order.constants-BWSCg3C7.d.mts.map +0 -1
  132. package/dist/purry-B2_0DGLV.cjs +0 -28
  133. package/dist/purry-B2_0DGLV.cjs.map +0 -1
  134. package/dist/purry-BOWmqwDB.mjs +0 -23
  135. package/dist/purry-BOWmqwDB.mjs.map +0 -1
@@ -1,17 +1,35 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_orThrow = require("../orThrow-ejzcQYAI.cjs");
3
- const require_purry = require("../purry-B2_0DGLV.cjs");
2
+ const require_function = require("../function-DYPifnmg.cjs");
3
+ const require_purry = require("../purry-Dqp_F64t.cjs");
4
4
  const require_errors = require("../errors-O-d_Vemi.cjs");
5
- require("../function-CB82a2GS.cjs");
6
5
  //#region src/array/_globalAliases.ts
7
- const { from, fromAsync, isArray, of } = Array;
8
- const arrayConstructor = Array;
9
- //#endregion
10
- //#region src/array/at.ts
11
6
  /**
12
- * Internal method that wraps `arr.at()` but throws the same `RangeError` that `arr.with()` does
13
- * @throws {RangeError}
7
+ * Creates an array from an iterable or array-like object.
8
+ * @function
9
+ */
10
+ const from = Array.from;
11
+ /**
12
+ * Creates an array from an async iterable.
13
+ * @function
14
+ */
15
+ const fromAsync = Array.fromAsync;
16
+ /**
17
+ * Checks whether a value is an array.
18
+ * @function
19
+ */
20
+ const isArray = Array.isArray;
21
+ /**
22
+ * Creates an array containing the given values.
23
+ * @function
24
+ */
25
+ const of = Array.of;
26
+ /**
27
+ * Alias of the built-in array constructor. `new Array() === new Arr.Ctor()
28
+ * @function
14
29
  */
30
+ const Ctor = Array;
31
+ //#endregion
32
+ //#region src/array/at.ts
15
33
  function atImplementation(arr, index) {
16
34
  if (arr.length === 0 || index >= arr.length || index < -arr.length) return /* @__PURE__ */ new RangeError(`Arr.at() :: Invalid index : ${index}`);
17
35
  return arr.at(index);
@@ -20,8 +38,18 @@ function at(...args) {
20
38
  return require_purry.purry(atImplementation, args);
21
39
  }
22
40
  function atAssert(...args) {
23
- return require_purry.purry(require_orThrow.orThrow(atImplementation), args);
41
+ return require_purry.purry(require_function.orThrow(atImplementation), args);
24
42
  }
43
+ /**
44
+ * Like `at`, but throws when the index is out of bounds.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * at.assert([1, 2, 3], 1); // 2
49
+ * at.assert(-1)([1, 2, 3]); // 3
50
+ * at.assert([1, 2, 3], 3); // throws RangeError
51
+ * ```
52
+ */
25
53
  at.assert = atAssert;
26
54
  //#endregion
27
55
  //#region src/array/chunk.ts
@@ -40,8 +68,17 @@ function chunk(...args) {
40
68
  return require_purry.purry(chunkImplementation, args);
41
69
  }
42
70
  function chunkAssert(...args) {
43
- return require_purry.purry(require_orThrow.orThrow(chunkImplementation), args);
71
+ return require_purry.purry(require_function.orThrow(chunkImplementation), args);
44
72
  }
73
+ /**
74
+ * Like `chunk`, but throws when the size is not a positive integer.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * chunk.assert([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
79
+ * chunk.assert(0)([1, 2, 3]); // throws RangeError
80
+ * ```
81
+ */
45
82
  chunk.assert = chunkAssert;
46
83
  //#endregion
47
84
  //#region src/array/concat.ts
@@ -78,8 +115,17 @@ function find(...args) {
78
115
  return require_purry.purry(findImplementation, args);
79
116
  }
80
117
  function findAssert(...args) {
81
- return require_purry.purry(require_orThrow.orThrow(findImplementation), args);
118
+ return require_purry.purry(require_function.orThrow(findImplementation), args);
82
119
  }
120
+ /**
121
+ * Like `find`, but throws when no element matches the predicate.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * find.assert([1, 2, 3], n => n > 1); // 2
126
+ * find.assert(n => n > 10)([1, 2, 3]); // throws NotFoundError
127
+ * ```
128
+ */
83
129
  find.assert = findAssert;
84
130
  //#endregion
85
131
  //#region src/array/findIndex.ts
@@ -92,8 +138,17 @@ function findIndex(...args) {
92
138
  return require_purry.purry(findIndexImplementation, args);
93
139
  }
94
140
  function findIndexAssert(...args) {
95
- return require_purry.purry(require_orThrow.orThrow(findIndexImplementation), args);
141
+ return require_purry.purry(require_function.orThrow(findIndexImplementation), args);
96
142
  }
143
+ /**
144
+ * Like `findIndex`, but throws when no element matches the predicate.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * findIndex.assert([1, 2, 3], n => n > 1); // 1
149
+ * findIndex.assert(n => n > 10)([1, 2, 3]); // throws NotFoundError
150
+ * ```
151
+ */
97
152
  findIndex.assert = findIndexAssert;
98
153
  //#endregion
99
154
  //#region src/array/findLast.ts
@@ -106,8 +161,17 @@ function findLast(...args) {
106
161
  return require_purry.purry(findLastImplementation, args);
107
162
  }
108
163
  function findLastAssert(...args) {
109
- return require_purry.purry(require_orThrow.orThrow(findLastImplementation), args);
164
+ return require_purry.purry(require_function.orThrow(findLastImplementation), args);
110
165
  }
166
+ /**
167
+ * Like `findLast`, but throws when no element matches the predicate.
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * findLast.assert([1, 2, 3, 2], n => n === 2); // 2
172
+ * findLast.assert(n => n > 10)([1, 2, 3]); // throws NotFoundError
173
+ * ```
174
+ */
111
175
  findLast.assert = findLastAssert;
112
176
  //#endregion
113
177
  //#region src/array/findLastIndex.ts
@@ -120,8 +184,17 @@ function findLastIndex(...args) {
120
184
  return require_purry.purry(findLastIndexImplementation, args);
121
185
  }
122
186
  function findLastIndexAssert(...args) {
123
- return require_purry.purry(require_orThrow.orThrow(findLastIndexImplementation), args);
187
+ return require_purry.purry(require_function.orThrow(findLastIndexImplementation), args);
124
188
  }
189
+ /**
190
+ * Like `findLastIndex`, but throws when no element matches the predicate.
191
+ *
192
+ * @example
193
+ * ```ts
194
+ * findLastIndex.assert([1, 2, 3, 2], n => n === 2); // 3
195
+ * findLastIndex.assert(n => n > 10)([1, 2, 3]); // throws NotFoundError
196
+ * ```
197
+ */
125
198
  findLastIndex.assert = findLastIndexAssert;
126
199
  //#endregion
127
200
  //#region src/array/first.ts
@@ -130,8 +203,17 @@ function first(arr) {
130
203
  return arr[0];
131
204
  }
132
205
  function firstAssert(arr) {
133
- return require_orThrow.orThrow(first)(arr);
206
+ return require_function.orThrow(first)(arr);
134
207
  }
208
+ /**
209
+ * Like `first`, but throws when the array is empty.
210
+ *
211
+ * @example
212
+ * ```ts
213
+ * first.assert([1, 2, 3]); // 1
214
+ * first.assert([]); // throws EmptyArrayError
215
+ * ```
216
+ */
135
217
  first.assert = firstAssert;
136
218
  //#endregion
137
219
  //#region src/array/flatMap.ts
@@ -153,14 +235,29 @@ function forEach(...args) {
153
235
  //#endregion
154
236
  //#region src/array/init.ts
155
237
  /**
238
+ * Returns all elements except the last.
156
239
  *
240
+ * @example
241
+ * ```ts
242
+ * init([1, 2, 3]); // [1, 2]
243
+ * init([1]); // []
244
+ * ```
157
245
  */
158
246
  function init(arr) {
159
247
  return arr.slice(0, arr.length - 1);
160
248
  }
161
249
  function initAssert(arr) {
162
- return require_orThrow.orThrow(init)(arr);
250
+ return require_function.orThrow(init)(arr);
163
251
  }
252
+ /**
253
+ * Like `init`, but throws when the array is empty.
254
+ *
255
+ * @example
256
+ * ```ts
257
+ * init.assert([1, 2, 3]); // [1, 2]
258
+ * init.assert([]); // throws EmptyArrayError
259
+ * ```
260
+ */
164
261
  init.assert = initAssert;
165
262
  //#endregion
166
263
  //#region src/array/insert.ts
@@ -175,8 +272,17 @@ function insert(...args) {
175
272
  return require_purry.purry(insertImplementation, args);
176
273
  }
177
274
  function insertAssert(...args) {
178
- return require_purry.purry(require_orThrow.orThrow(insertImplementation), args);
275
+ return require_purry.purry(require_function.orThrow(insertImplementation), args);
179
276
  }
277
+ /**
278
+ * Like `insert`, but throws when the index is invalid.
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * insert.assert([1, 2, 3], 1, 9); // [1, 9, 3]
283
+ * insert.assert(10, 9)([1, 2, 3]); // throws RangeError
284
+ * ```
285
+ */
180
286
  insert.assert = insertAssert;
181
287
  //#endregion
182
288
  //#region src/array/isEmpty.ts
@@ -201,15 +307,28 @@ function last(arr) {
201
307
  return arr[arr.length - 1];
202
308
  }
203
309
  function lastAssert(arr) {
204
- return require_orThrow.orThrow(last)(arr);
310
+ return require_function.orThrow(last)(arr);
205
311
  }
312
+ /**
313
+ * Like `last`, but throws when the array is empty.
314
+ *
315
+ * @example
316
+ * ```ts
317
+ * last.assert([1, 2, 3]); // 3
318
+ * last.assert([]); // throws EmptyArrayError
319
+ * ```
320
+ */
206
321
  last.assert = lastAssert;
207
322
  //#endregion
208
323
  //#region src/array/length.ts
209
324
  /**
210
- * Returns length of array
211
- * @param arr
212
- * @returns
325
+ * Returns the number of elements in an array.
326
+ *
327
+ * @example
328
+ * ```ts
329
+ * length([1, 2, 3]); // 3
330
+ * length([]); // 0
331
+ * ```
213
332
  */
214
333
  function length(arr) {
215
334
  return arr.length;
@@ -225,9 +344,13 @@ function map(...args) {
225
344
  //#endregion
226
345
  //#region src/array/ofLength.ts
227
346
  /**
228
- * Arr.ofLength
347
+ * Creates a sparse array with the given length.
229
348
  *
230
- * @throws {RangeError}
349
+ * @example
350
+ * ```ts
351
+ * ofLength(3); // [empty × 3]
352
+ * ofLength<string>(2); // [empty × 2]
353
+ * ```
231
354
  */
232
355
  function ofLength(arrayLength) {
233
356
  return Array(arrayLength);
@@ -256,8 +379,17 @@ function pop(arr) {
256
379
  return [arr[lastIndex], arr.slice(0, lastIndex)];
257
380
  }
258
381
  function popAssert(arr) {
259
- return require_orThrow.orThrow(pop)(arr);
382
+ return require_function.orThrow(pop)(arr);
260
383
  }
384
+ /**
385
+ * Like `pop`, but throws when the array is empty.
386
+ *
387
+ * @example
388
+ * ```ts
389
+ * pop.assert([1, 2, 3]); // [3, [1, 2]]
390
+ * pop.assert([]); // throws EmptyArrayError
391
+ * ```
392
+ */
261
393
  pop.assert = popAssert;
262
394
  //#endregion
263
395
  //#region src/array/prepend.ts
@@ -310,9 +442,13 @@ function reduceRight1(...args) {
310
442
  //#endregion
311
443
  //#region src/array/rest.ts
312
444
  /**
313
- * Returns an array excluding the first entry
314
- * @param arr
315
- * @returns
445
+ * Returns all elements except the first.
446
+ *
447
+ * @example
448
+ * ```ts
449
+ * rest([1, 2, 3]); // [2, 3]
450
+ * rest([1]); // []
451
+ * ```
316
452
  */
317
453
  function rest(arr) {
318
454
  const [, ...tail] = arr;
@@ -320,12 +456,17 @@ function rest(arr) {
320
456
  }
321
457
  //#endregion
322
458
  //#region src/array/reverse.ts
323
- function reverseImplementation(arr) {
459
+ /**
460
+ * Returns a reversed copy of an array without mutating the original.
461
+ *
462
+ * @example
463
+ * ```ts
464
+ * reverse([1, 2, 3]); // [3, 2, 1]
465
+ * ```
466
+ */
467
+ function reverse(arr) {
324
468
  return arr.toReversed();
325
469
  }
326
- function reverse(...args) {
327
- return require_purry.purry(reverseImplementation, args);
328
- }
329
470
  //#endregion
330
471
  //#region src/array/scan.ts
331
472
  function scanImplementation(arr, callbackFn, initialValue) {
@@ -350,11 +491,28 @@ function shift(arr) {
350
491
  return [head, tail];
351
492
  }
352
493
  function shiftAssert(arr) {
353
- return require_orThrow.orThrow(shift)(arr);
494
+ return require_function.orThrow(shift)(arr);
354
495
  }
496
+ /**
497
+ * Like `shift`, but throws when the array is empty.
498
+ *
499
+ * @example
500
+ * ```ts
501
+ * shift.assert([1, 2, 3]); // [1, [2, 3]]
502
+ * shift.assert([]); // throws EmptyArrayError
503
+ * ```
504
+ */
355
505
  shift.assert = shiftAssert;
356
506
  //#endregion
357
507
  //#region src/array/shuffle.ts
508
+ /**
509
+ * Returns a shuffled copy of an array using the Fisher-Yates algorithm.
510
+ *
511
+ * @example
512
+ * ```ts
513
+ * shuffle([1, 2, 3, 4]); // e.g. [3, 1, 4, 2]
514
+ * ```
515
+ */
358
516
  function shuffle(arr) {
359
517
  const result = [...arr];
360
518
  const len = result.length;
@@ -407,12 +565,29 @@ function take(...args) {
407
565
  }
408
566
  //#endregion
409
567
  //#region src/array/transpose.ts
568
+ /**
569
+ * Transposes a matrix so rows become columns and columns become rows.
570
+ *
571
+ * @example
572
+ * ```ts
573
+ * transpose([[1, 2], [3, 4], [5, 6]]); // [[1, 3, 5], [2, 4, 6]]
574
+ * ```
575
+ */
410
576
  function transpose(arr) {
411
577
  const maxLen = arr.reduce((acc, inner) => Math.max(acc, inner.length), 0);
412
578
  return Array(maxLen).fill(void 0).map((_, index) => arr.map((inner) => inner[index]));
413
579
  }
414
580
  //#endregion
415
581
  //#region src/array/unique.ts
582
+ /**
583
+ * Returns a copy of an array with duplicate values removed.
584
+ *
585
+ * @example
586
+ * ```ts
587
+ * unique([1, 2, 2, 3]); // [1, 2, 3]
588
+ * unique([]); // []
589
+ * ```
590
+ */
416
591
  function unique(arr) {
417
592
  if (arr.length === 0) return [];
418
593
  return Array.from(new Set(arr));
@@ -434,6 +609,16 @@ function uniqueBy(...args) {
434
609
  }
435
610
  //#endregion
436
611
  //#region src/array/uniqueWith.ts
612
+ /**
613
+ * Returns a copy of an array with duplicates removed using a custom equality function.
614
+ * Keeps the first occurrence of each equivalent value.
615
+ *
616
+ * @example
617
+ * ```ts
618
+ * uniqueWith([1, 1.0, 2], (a, b) => a === b); // [1, 2]
619
+ * uniqueWith([], (a, b) => a === b); // []
620
+ * ```
621
+ */
437
622
  function uniqueWith(arr, isEqual) {
438
623
  if (arr.length === 0) return [];
439
624
  return arr.filter((value, index) => {
@@ -459,8 +644,17 @@ function update(...args) {
459
644
  return require_purry.purry(updateImplementation, args);
460
645
  }
461
646
  function updateAssert(...args) {
462
- return require_purry.purry(require_orThrow.orThrow(updateImplementation), args);
647
+ return require_purry.purry(require_function.orThrow(updateImplementation), args);
463
648
  }
649
+ /**
650
+ * Like `update`, but throws when the index is out of bounds.
651
+ *
652
+ * @example
653
+ * ```ts
654
+ * update.assert([1, 2, 3], 1, n => n * 10); // [1, 20, 3]
655
+ * update.assert(10, n => n)([1, 2, 3]); // throws RangeError
656
+ * ```
657
+ */
464
658
  update.assert = updateAssert;
465
659
  //#endregion
466
660
  //#region src/array/window.ts
@@ -474,8 +668,17 @@ function window(...args) {
474
668
  return require_purry.purry(windowImplementation, args);
475
669
  }
476
670
  function windowAssert(...args) {
477
- return require_purry.purry(require_orThrow.orThrow(windowImplementation), args);
671
+ return require_purry.purry(require_function.orThrow(windowImplementation), args);
478
672
  }
673
+ /**
674
+ * Like `window`, but throws when the size is not a positive integer.
675
+ *
676
+ * @example
677
+ * ```ts
678
+ * window.assert([1, 2, 3, 4], 2); // [[1, 2], [2, 3], [3, 4]]
679
+ * window.assert(0)([1, 2, 3]); // throws RangeError
680
+ * ```
681
+ */
479
682
  window.assert = windowAssert;
480
683
  //#endregion
481
684
  //#region src/array/zip.ts
@@ -494,9 +697,8 @@ function zipWith(...args) {
494
697
  return require_purry.purry(zipWithImplementation, args);
495
698
  }
496
699
  //#endregion
497
- exports.Array = arrayConstructor;
700
+ exports.Ctor = Ctor;
498
701
  exports.at = at;
499
- exports.atAssert = atAssert;
500
702
  exports.chunk = chunk;
501
703
  exports.concat = concat;
502
704
  exports.drop = drop;