@rimbu/base 2.0.2 → 2.0.4

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 (42) hide show
  1. package/README.md +165 -35
  2. package/dist/bun/arr.mts +184 -19
  3. package/dist/bun/entry.mts +14 -2
  4. package/dist/bun/index.mts +10 -0
  5. package/dist/bun/rimbu-error.mts +25 -0
  6. package/dist/bun/token.mts +7 -0
  7. package/dist/cjs/arr.cjs +184 -19
  8. package/dist/cjs/arr.cjs.map +1 -1
  9. package/dist/cjs/arr.d.cts +184 -0
  10. package/dist/cjs/entry.cjs +14 -2
  11. package/dist/cjs/entry.cjs.map +1 -1
  12. package/dist/cjs/entry.d.cts +14 -0
  13. package/dist/cjs/index.cjs +10 -0
  14. package/dist/cjs/index.cjs.map +1 -1
  15. package/dist/cjs/index.d.cts +9 -0
  16. package/dist/cjs/rimbu-error.cjs +25 -0
  17. package/dist/cjs/rimbu-error.cjs.map +1 -1
  18. package/dist/cjs/rimbu-error.d.cts +25 -0
  19. package/dist/cjs/token.cjs +4 -0
  20. package/dist/cjs/token.cjs.map +1 -1
  21. package/dist/cjs/token.d.cts +7 -0
  22. package/dist/esm/arr.d.mts +184 -0
  23. package/dist/esm/arr.mjs +184 -19
  24. package/dist/esm/arr.mjs.map +1 -1
  25. package/dist/esm/entry.d.mts +14 -0
  26. package/dist/esm/entry.mjs +14 -2
  27. package/dist/esm/entry.mjs.map +1 -1
  28. package/dist/esm/index.d.mts +9 -0
  29. package/dist/esm/index.mjs +10 -0
  30. package/dist/esm/index.mjs.map +1 -1
  31. package/dist/esm/rimbu-error.d.mts +25 -0
  32. package/dist/esm/rimbu-error.mjs +25 -0
  33. package/dist/esm/rimbu-error.mjs.map +1 -1
  34. package/dist/esm/token.d.mts +7 -0
  35. package/dist/esm/token.mjs +4 -0
  36. package/dist/esm/token.mjs.map +1 -1
  37. package/package.json +4 -9
  38. package/src/arr.mts +184 -19
  39. package/src/entry.mts +14 -2
  40. package/src/index.mts +10 -0
  41. package/src/rimbu-error.mts +25 -0
  42. package/src/token.mts +7 -0
@@ -1,17 +1,26 @@
1
1
  import { ErrBase } from '@rimbu/common';
2
2
 
3
+ /**
4
+ * Error thrown when an operation assumes a collection is non-empty but it is empty.
5
+ */
3
6
  export class EmptyCollectionAssumedNonEmptyError extends ErrBase.CustomError {
4
7
  constructor() {
5
8
  super('empty collection was assumbed to be non-empty');
6
9
  }
7
10
  }
8
11
 
12
+ /**
13
+ * Error thrown when a builder is modified while it is being iterated.
14
+ */
9
15
  export class ModifiedBuilderWhileLoopingOverItError extends ErrBase.CustomError {
10
16
  constructor() {
11
17
  super('an attempt was made to modify a builder while looping over it');
12
18
  }
13
19
  }
14
20
 
21
+ /**
22
+ * Error indicating an unexpected internal state. Users are encouraged to file an issue.
23
+ */
15
24
  export class InvalidStateError extends ErrBase.CustomError {
16
25
  constructor() {
17
26
  super(
@@ -20,20 +29,36 @@ export class InvalidStateError extends ErrBase.CustomError {
20
29
  }
21
30
  }
22
31
 
32
+ /**
33
+ * Error indicating incorrect usage of the API.
34
+ */
23
35
  export class InvalidUsageError extends ErrBase.CustomError {}
24
36
 
37
+ /**
38
+ * Throws an `EmptyCollectionAssumedNonEmptyError`.
39
+ */
25
40
  export function throwEmptyCollectionAssumedNonEmptyError(): never {
26
41
  throw new EmptyCollectionAssumedNonEmptyError();
27
42
  }
28
43
 
44
+ /**
45
+ * Throws a `ModifiedBuilderWhileLoopingOverItError`.
46
+ */
29
47
  export function throwModifiedBuilderWhileLoopingOverItError(): never {
30
48
  throw new ModifiedBuilderWhileLoopingOverItError();
31
49
  }
32
50
 
51
+ /**
52
+ * Throws an `InvalidStateError`.
53
+ */
33
54
  export function throwInvalidStateError(): never {
34
55
  throw new InvalidStateError();
35
56
  }
36
57
 
58
+ /**
59
+ * Throws an `InvalidUsageError` with the provided message.
60
+ * @param msg - context message describing the invalid usage
61
+ */
37
62
  export function throwInvalidUsageError(msg: string): never {
38
63
  throw new InvalidUsageError(msg);
39
64
  }
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Unique symbol used as a nominal token within the base package.
3
+ * Can be employed for branding or sentinel values.
4
+ */
1
5
  export const Token = Symbol('Token');
6
+ /**
7
+ * Type alias representing the Token symbol.
8
+ */
2
9
  export type Token = typeof Token;
package/dist/cjs/arr.cjs CHANGED
@@ -27,17 +27,46 @@ exports.copySparse = copySparse;
27
27
  exports.mapSparse = mapSparse;
28
28
  var tslib_1 = require("tslib");
29
29
  var common_1 = require("@rimbu/common");
30
+ /**
31
+ * Internal helper that appends a value using the modern immutable `toSpliced` API.
32
+ * @internal
33
+ * @typeparam T - the array element type
34
+ * @param array - the source array (not mutated)
35
+ * @param value - the value to append
36
+ * @returns a new non-empty array with the value at the end
37
+ */
30
38
  function _appendNew(array, value) {
31
39
  return array.toSpliced(array.length, 0, value);
32
40
  }
41
+ /**
42
+ * Internal helper that appends a value by cloning and pushing (legacy fallback).
43
+ * @internal
44
+ * @typeparam T - the array element type
45
+ * @param array - the source array (not mutated)
46
+ * @param value - the value to append
47
+ * @returns a new non-empty array with the value at the end
48
+ */
33
49
  function _appendOld(array, value) {
34
50
  var clone = array.slice();
35
51
  clone.push(value);
36
52
  return clone;
37
53
  }
38
- // Returns a copy of the array with the given value appended
54
+ /**
55
+ * Returns a copy of the array with the given value appended.
56
+ * Chooses an implementation depending on environment capabilities.
57
+ * @typeparam T - the array element type
58
+ * @param array - the source array (not mutated)
59
+ * @param value - the value to append
60
+ * @returns a new array with the value at the end
61
+ */
39
62
  exports.append = "toSpliced" in Array.prototype ? _appendNew : _appendOld;
40
- // Returns the concatenation of the two arrays, potentially reusing the input array if one of the arrays is empty
63
+ /**
64
+ * Returns the concatenation of two arrays, reusing an input array when the other is empty.
65
+ * @typeparam T - the array element type
66
+ * @param first - the first array
67
+ * @param second - the second array
68
+ * @returns a new array containing all elements of both arrays (or one of the originals if the other is empty)
69
+ */
41
70
  function concat(first, second) {
42
71
  if (first.length === 0)
43
72
  return second;
@@ -45,12 +74,20 @@ function concat(first, second) {
45
74
  return first;
46
75
  return first.concat(second);
47
76
  }
77
+ /**
78
+ * Internal helper to create a reversed copy using modern `toReversed` with optional slicing.
79
+ * @internal
80
+ */
48
81
  function _reverseNew(array, start, end) {
49
82
  var source = undefined !== start || undefined !== end
50
83
  ? array.slice(start !== null && start !== void 0 ? start : 0, (end !== null && end !== void 0 ? end : array.length - 1) + 1)
51
84
  : array;
52
85
  return source.toReversed();
53
86
  }
87
+ /**
88
+ * Internal helper to create a reversed copy using manual iteration (legacy fallback).
89
+ * @internal
90
+ */
54
91
  function _reverseOld(array, start, end) {
55
92
  var _start = start !== null && start !== void 0 ? start : 0;
56
93
  var _end = end !== null && end !== void 0 ? end : array.length - 1;
@@ -62,9 +99,23 @@ function _reverseOld(array, start, end) {
62
99
  res[resIndex--] = array[arrayIndex];
63
100
  return res;
64
101
  }
65
- // Returns an copy of the array between the start and end indices, with the elements in reversed order.
102
+ /**
103
+ * Returns a copy of the array (or a slice) with elements in reversed order.
104
+ * @typeparam T - array element type
105
+ * @param array - the source array
106
+ * @param start - optional start index (inclusive)
107
+ * @param end - optional end index (inclusive)
108
+ */
66
109
  exports.reverse = 'toReversed' in Array.prototype ? _reverseNew : _reverseOld;
67
- // Performs given function on each element of the array, in reverse order if 'reversed' is true.
110
+ /**
111
+ * Performs the given function for each element of the array, optionally in reverse order.
112
+ * Halting is supported through the provided `TraverseState`.
113
+ * @typeparam T - element type
114
+ * @param array - the source array
115
+ * @param f - callback receiving (value, sequential index, halt)
116
+ * @param state - traversal state (created if omitted)
117
+ * @param reversed - whether to traverse in reverse order
118
+ */
68
119
  function forEach(array, f, state, reversed) {
69
120
  if (state === void 0) { state = (0, common_1.TraverseState)(); }
70
121
  if (reversed === void 0) { reversed = false; }
@@ -85,7 +136,15 @@ function forEach(array, f, state, reversed) {
85
136
  }
86
137
  }
87
138
  }
88
- // Returns a copy of the array where given function is applied to each element
139
+ /**
140
+ * Returns a copy of the array where the given function is applied to each element.
141
+ * Supports an index offset useful for composed traversals.
142
+ * @typeparam T - source element type
143
+ * @typeparam R - result element type
144
+ * @param array - the source array
145
+ * @param f - the mapping function
146
+ * @param indexOffset - optional start index value passed to `f`
147
+ */
89
148
  function map(array, f, indexOffset) {
90
149
  if (indexOffset === void 0) { indexOffset = 0; }
91
150
  if (indexOffset === 0) {
@@ -101,7 +160,14 @@ function map(array, f, indexOffset) {
101
160
  }
102
161
  return result;
103
162
  }
104
- // Returns a copy of the array where given functio is applied to each element in reverse order
163
+ /**
164
+ * Returns a copy of the array where the given function is applied to each element in reverse order.
165
+ * @typeparam T - source element type
166
+ * @typeparam R - result element type
167
+ * @param array - the source array
168
+ * @param f - the mapping function
169
+ * @param indexOffset - optional index offset passed to `f`
170
+ */
105
171
  function reverseMap(array, f, indexOffset) {
106
172
  if (indexOffset === void 0) { indexOffset = 0; }
107
173
  var result = [];
@@ -112,24 +178,53 @@ function reverseMap(array, f, indexOffset) {
112
178
  result[resultIndex++] = f(array[arrayIndex], index++);
113
179
  return result;
114
180
  }
181
+ /**
182
+ * Internal helper to prepend a value using `toSpliced`.
183
+ * @internal
184
+ */
115
185
  function _prependNew(array, value) {
116
186
  return array.toSpliced(0, 0, value);
117
187
  }
188
+ /**
189
+ * Internal helper to prepend a value using legacy cloning.
190
+ * @internal
191
+ */
118
192
  function _prependOld(array, value) {
119
193
  var clone = array.slice();
120
194
  clone.unshift(value);
121
195
  return clone;
122
196
  }
123
- // Returns a copy of the given array with the given value added at the start
197
+ /**
198
+ * Returns a copy of the array with the given value inserted at the start.
199
+ * @typeparam T - element type
200
+ * @param array - the source array
201
+ * @param value - value to insert at index 0
202
+ */
124
203
  exports.prepend = "toSpliced" in Array.prototype ? _prependNew : _prependOld;
204
+ /**
205
+ * Internal helper to obtain the last element using modern `at`.
206
+ * @internal
207
+ */
125
208
  function _lastNew(arr) {
126
209
  return arr.at(-1);
127
210
  }
211
+ /**
212
+ * Internal helper to obtain the last element using index arithmetic.
213
+ * @internal
214
+ */
128
215
  function _lastOld(arr) {
129
216
  return arr[arr.length - 1];
130
217
  }
131
- // Returns the last element of the array
218
+ /**
219
+ * Returns the last element of the array.
220
+ * @typeparam T - element type
221
+ * @param arr - the array
222
+ */
132
223
  exports.last = "at" in Array.prototype ? _lastNew : _lastOld;
224
+ /**
225
+ * Internal helper implementing an immutable index update via `with`.
226
+ * @internal
227
+ */
133
228
  function _updateNew(arr, index, updater) {
134
229
  if (index < 0 || index >= arr.length) {
135
230
  return arr;
@@ -141,6 +236,10 @@ function _updateNew(arr, index, updater) {
141
236
  }
142
237
  return arr.with(index, newValue);
143
238
  }
239
+ /**
240
+ * Internal helper implementing an immutable index update via cloning.
241
+ * @internal
242
+ */
144
243
  function _updateOld(arr, index, updater) {
145
244
  if (index < 0 || index >= arr.length) {
146
245
  return arr;
@@ -154,9 +253,19 @@ function _updateOld(arr, index, updater) {
154
253
  newArr[index] = newValue;
155
254
  return newArr;
156
255
  }
157
- // Returns a copy of the array where the element at given index is replaced by the given updater.
158
- // If the new element is the same as the old element, the original array is returned
256
+ /**
257
+ * Returns a copy of the array where the element at the given index is replaced using the provided updater.
258
+ * If the result value is identical (by `Object.is`) the original array is returned.
259
+ * @typeparam T - element type
260
+ * @param arr - the source array
261
+ * @param index - the index to update
262
+ * @param updater - value or function update description
263
+ */
159
264
  exports.update = "with" in Array.prototype ? _updateNew : _updateOld;
265
+ /**
266
+ * Internal helper applying a modifier function via `with`.
267
+ * @internal
268
+ */
160
269
  function _modNew(arr, index, f) {
161
270
  if (index < 0 || index >= arr.length) {
162
271
  return arr;
@@ -168,6 +277,10 @@ function _modNew(arr, index, f) {
168
277
  }
169
278
  return arr.with(index, newValue);
170
279
  }
280
+ /**
281
+ * Internal helper applying a modifier function via cloning.
282
+ * @internal
283
+ */
171
284
  function _modOld(arr, index, f) {
172
285
  if (index < 0 || index >= arr.length) {
173
286
  return arr;
@@ -181,27 +294,59 @@ function _modOld(arr, index, f) {
181
294
  newArr[index] = newValue;
182
295
  return newArr;
183
296
  }
184
- // Returns a copy of the array where the element at given index is replaced by applying given function.
185
- // If the new element is the same as the old element, the original array is returned
297
+ /**
298
+ * Returns a copy of the array where the element at the given index is transformed by a modifier function.
299
+ * If the result value is identical (by `Object.is`) the original array is returned.
300
+ * @typeparam T - element type
301
+ * @param arr - the source array
302
+ * @param index - the index to modify
303
+ * @param f - modifier function receiving the current value
304
+ */
186
305
  exports.mod = "with" in Array.prototype ? _modNew : _modOld;
306
+ /**
307
+ * Internal helper for inserting a value using `toSpliced`.
308
+ * @internal
309
+ */
187
310
  function _insertNew(arr, index, value) {
188
311
  return arr.toSpliced(index, 0, value);
189
312
  }
313
+ /**
314
+ * Internal helper for inserting a value using legacy `splice` on a clone.
315
+ * @internal
316
+ */
190
317
  function _insertOld(arr, index, value) {
191
318
  var clone = arr.slice();
192
319
  clone.splice(index, 0, value);
193
320
  return clone;
194
321
  }
195
- // Returns a copy of the array where at given index the given value is inserted
322
+ /**
323
+ * Returns a copy of the array where at the given index the provided value is inserted.
324
+ * @typeparam T - element type
325
+ * @param arr - the source array
326
+ * @param index - insertion index
327
+ * @param value - value to insert
328
+ */
196
329
  exports.insert = "toSpliced" in Array.prototype ? _insertNew : _insertOld;
197
- // Returns a copy of the array, without its first element
330
+ /**
331
+ * Returns a copy of the array without its first element.
332
+ * @typeparam T - element type
333
+ * @param arr - the source array
334
+ */
198
335
  function tail(arr) {
199
336
  return arr.slice(1);
200
337
  }
201
- // Returns a copy of the array, without its last element
338
+ /**
339
+ * Returns a copy of the array without its last element.
340
+ * @typeparam T - element type
341
+ * @param arr - the source array
342
+ */
202
343
  function init(arr) {
203
344
  return arr.slice(0, arr.length - 1);
204
345
  }
346
+ /**
347
+ * Internal helper providing an immutable `splice` using `toSpliced`.
348
+ * @internal
349
+ */
205
350
  function _spliceNew(arr, start, deleteCount) {
206
351
  var items = [];
207
352
  for (var _i = 3; _i < arguments.length; _i++) {
@@ -209,6 +354,10 @@ function _spliceNew(arr, start, deleteCount) {
209
354
  }
210
355
  return arr.toSpliced.apply(arr, tslib_1.__spreadArray([start, deleteCount], tslib_1.__read(items), false));
211
356
  }
357
+ /**
358
+ * Internal helper providing an immutable `splice` via cloning.
359
+ * @internal
360
+ */
212
361
  function _spliceOld(arr, start, deleteCount) {
213
362
  var items = [];
214
363
  for (var _i = 3; _i < arguments.length; _i++) {
@@ -218,9 +367,20 @@ function _spliceOld(arr, start, deleteCount) {
218
367
  clone.splice.apply(clone, tslib_1.__spreadArray([start, deleteCount], tslib_1.__read(items), false));
219
368
  return clone;
220
369
  }
221
- // Immutable version of the array .splice command, always returns a new array
370
+ /**
371
+ * Immutable version of the array `.splice` command, always returning a new array.
372
+ * @typeparam T - element type
373
+ * @param arr - the source array
374
+ * @param start - start index
375
+ * @param deleteCount - number of elements to delete
376
+ * @param items - optional items to insert
377
+ */
222
378
  exports.splice = "toSpliced" in Array.prototype ? _spliceNew : _spliceOld;
223
- // Returns a copy of the array, where its 'sparse' property is kept (sparse = not all indices have a value)
379
+ /**
380
+ * Returns a copy of a (potentially) sparse array preserving sparsity (skips holes).
381
+ * @typeparam T - element type
382
+ * @param arr - the source sparse array
383
+ */
224
384
  function copySparse(arr) {
225
385
  var clone = [];
226
386
  for (var key in arr) {
@@ -228,8 +388,13 @@ function copySparse(arr) {
228
388
  }
229
389
  return clone;
230
390
  }
231
- // Returns a copy of the array with given function applied to each element, where its 'sparse' property is kept
232
- // (sparse = not all indices have a value)
391
+ /**
392
+ * Returns a copy of a sparse array applying the given function to each present element, preserving holes.
393
+ * @typeparam T - source element type
394
+ * @typeparam T2 - result element type
395
+ * @param arr - the source sparse array
396
+ * @param f - mapping function
397
+ */
233
398
  function mapSparse(arr, f) {
234
399
  var result = Array(arr.length);
235
400
  for (var key in arr) {
@@ -1 +1 @@
1
- {"version":3,"file":"arr.cjs","sourceRoot":"","sources":["../../_cjs_prepare/arr.cts"],"names":[],"mappings":";;;AAEA,gCAEC;AAED,gCAIC;AAMD,wBAOC;AAED,kCA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QAAb,8BAAa;;IAEb,OAAO,GAAG,CAAC,SAAS,OAAb,GAAG,yBAAW,KAAK,EAAE,WAAW,kBAAK,KAAK,WAAE;AACrD,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU,CACxB,GAAiB,EACjB,KAAa,EACb,WAAmB;IACnB,eAAa;SAAb,UAAa,EAAb,qBAAa,EAAb,IAAa;QAAb,8BAAa;;IAEb,IAAM,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;IAC1B,KAAK,CAAC,MAAM,OAAZ,KAAK,yBAAQ,KAAK,EAAE,WAAW,kBAAK,KAAK,WAAE;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACU,QAAA,MAAM,GAAG,WAAW,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;AAE/E;;;;GAIG;AACH,SAAgB,UAAU,CAAI,GAAiB;IAC7C,IAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,KAAK,IAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CACvB,GAAiB,EACjB,CAAkC;IAElC,IAAM,MAAM,GAAS,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEvC,KAAK,IAAM,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAU,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,33 +1,217 @@
1
1
  import { TraverseState, Update, type ArrayNonEmpty } from '@rimbu/common';
2
+ /**
3
+ * Internal helper that appends a value using the modern immutable `toSpliced` API.
4
+ * @internal
5
+ * @typeparam T - the array element type
6
+ * @param array - the source array (not mutated)
7
+ * @param value - the value to append
8
+ * @returns a new non-empty array with the value at the end
9
+ */
2
10
  export declare function _appendNew<T>(array: readonly T[], value: T): ArrayNonEmpty<T>;
11
+ /**
12
+ * Internal helper that appends a value by cloning and pushing (legacy fallback).
13
+ * @internal
14
+ * @typeparam T - the array element type
15
+ * @param array - the source array (not mutated)
16
+ * @param value - the value to append
17
+ * @returns a new non-empty array with the value at the end
18
+ */
3
19
  export declare function _appendOld<T>(array: readonly T[], value: T): ArrayNonEmpty<T>;
20
+ /**
21
+ * Returns a copy of the array with the given value appended.
22
+ * Chooses an implementation depending on environment capabilities.
23
+ * @typeparam T - the array element type
24
+ * @param array - the source array (not mutated)
25
+ * @param value - the value to append
26
+ * @returns a new array with the value at the end
27
+ */
4
28
  export declare const append: typeof _appendNew;
29
+ /**
30
+ * Returns the concatenation of two arrays, reusing an input array when the other is empty.
31
+ * @typeparam T - the array element type
32
+ * @param first - the first array
33
+ * @param second - the second array
34
+ * @returns a new array containing all elements of both arrays (or one of the originals if the other is empty)
35
+ */
5
36
  export declare function concat<T>(first: readonly T[], second: readonly T[]): readonly T[];
37
+ /**
38
+ * Internal helper to create a reversed copy using modern `toReversed` with optional slicing.
39
+ * @internal
40
+ */
6
41
  export declare function _reverseNew<T>(array: readonly T[], start?: number, end?: number): T[];
42
+ /**
43
+ * Internal helper to create a reversed copy using manual iteration (legacy fallback).
44
+ * @internal
45
+ */
7
46
  export declare function _reverseOld<T>(array: readonly T[], start?: number, end?: number): T[];
47
+ /**
48
+ * Returns a copy of the array (or a slice) with elements in reversed order.
49
+ * @typeparam T - array element type
50
+ * @param array - the source array
51
+ * @param start - optional start index (inclusive)
52
+ * @param end - optional end index (inclusive)
53
+ */
8
54
  export declare const reverse: typeof _reverseNew;
55
+ /**
56
+ * Performs the given function for each element of the array, optionally in reverse order.
57
+ * Halting is supported through the provided `TraverseState`.
58
+ * @typeparam T - element type
59
+ * @param array - the source array
60
+ * @param f - callback receiving (value, sequential index, halt)
61
+ * @param state - traversal state (created if omitted)
62
+ * @param reversed - whether to traverse in reverse order
63
+ */
9
64
  export declare function forEach<T>(array: readonly T[], f: (value: T, index: number, halt: () => void) => void, state?: TraverseState, reversed?: boolean): void;
65
+ /**
66
+ * Returns a copy of the array where the given function is applied to each element.
67
+ * Supports an index offset useful for composed traversals.
68
+ * @typeparam T - source element type
69
+ * @typeparam R - result element type
70
+ * @param array - the source array
71
+ * @param f - the mapping function
72
+ * @param indexOffset - optional start index value passed to `f`
73
+ */
10
74
  export declare function map<T, R>(array: readonly T[], f: (value: T, index: number) => R, indexOffset?: number): R[];
75
+ /**
76
+ * Returns a copy of the array where the given function is applied to each element in reverse order.
77
+ * @typeparam T - source element type
78
+ * @typeparam R - result element type
79
+ * @param array - the source array
80
+ * @param f - the mapping function
81
+ * @param indexOffset - optional index offset passed to `f`
82
+ */
11
83
  export declare function reverseMap<T, R>(array: readonly T[], f: (value: T, index: number) => R, indexOffset?: number): R[];
84
+ /**
85
+ * Internal helper to prepend a value using `toSpliced`.
86
+ * @internal
87
+ */
12
88
  export declare function _prependNew<T>(array: readonly T[], value: T): ArrayNonEmpty<T>;
89
+ /**
90
+ * Internal helper to prepend a value using legacy cloning.
91
+ * @internal
92
+ */
13
93
  export declare function _prependOld<T>(array: readonly T[], value: T): ArrayNonEmpty<T>;
94
+ /**
95
+ * Returns a copy of the array with the given value inserted at the start.
96
+ * @typeparam T - element type
97
+ * @param array - the source array
98
+ * @param value - value to insert at index 0
99
+ */
14
100
  export declare const prepend: typeof _prependNew;
101
+ /**
102
+ * Internal helper to obtain the last element using modern `at`.
103
+ * @internal
104
+ */
15
105
  export declare function _lastNew<T>(arr: readonly T[]): T;
106
+ /**
107
+ * Internal helper to obtain the last element using index arithmetic.
108
+ * @internal
109
+ */
16
110
  export declare function _lastOld<T>(arr: readonly T[]): T;
111
+ /**
112
+ * Returns the last element of the array.
113
+ * @typeparam T - element type
114
+ * @param arr - the array
115
+ */
17
116
  export declare const last: typeof _lastNew;
117
+ /**
118
+ * Internal helper implementing an immutable index update via `with`.
119
+ * @internal
120
+ */
18
121
  export declare function _updateNew<T>(arr: readonly T[], index: number, updater: Update<T>): readonly T[];
122
+ /**
123
+ * Internal helper implementing an immutable index update via cloning.
124
+ * @internal
125
+ */
19
126
  export declare function _updateOld<T>(arr: readonly T[], index: number, updater: Update<T>): readonly T[];
127
+ /**
128
+ * Returns a copy of the array where the element at the given index is replaced using the provided updater.
129
+ * If the result value is identical (by `Object.is`) the original array is returned.
130
+ * @typeparam T - element type
131
+ * @param arr - the source array
132
+ * @param index - the index to update
133
+ * @param updater - value or function update description
134
+ */
20
135
  export declare const update: typeof _updateNew;
136
+ /**
137
+ * Internal helper applying a modifier function via `with`.
138
+ * @internal
139
+ */
21
140
  export declare function _modNew<T>(arr: readonly T[], index: number, f: (value: T) => T): readonly T[];
141
+ /**
142
+ * Internal helper applying a modifier function via cloning.
143
+ * @internal
144
+ */
22
145
  export declare function _modOld<T>(arr: readonly T[], index: number, f: (value: T) => T): readonly T[];
146
+ /**
147
+ * Returns a copy of the array where the element at the given index is transformed by a modifier function.
148
+ * If the result value is identical (by `Object.is`) the original array is returned.
149
+ * @typeparam T - element type
150
+ * @param arr - the source array
151
+ * @param index - the index to modify
152
+ * @param f - modifier function receiving the current value
153
+ */
23
154
  export declare const mod: typeof _modNew;
155
+ /**
156
+ * Internal helper for inserting a value using `toSpliced`.
157
+ * @internal
158
+ */
24
159
  export declare function _insertNew<T>(arr: readonly T[], index: number, value: T): T[];
160
+ /**
161
+ * Internal helper for inserting a value using legacy `splice` on a clone.
162
+ * @internal
163
+ */
25
164
  export declare function _insertOld<T>(arr: readonly T[], index: number, value: T): T[];
165
+ /**
166
+ * Returns a copy of the array where at the given index the provided value is inserted.
167
+ * @typeparam T - element type
168
+ * @param arr - the source array
169
+ * @param index - insertion index
170
+ * @param value - value to insert
171
+ */
26
172
  export declare const insert: typeof _insertNew;
173
+ /**
174
+ * Returns a copy of the array without its first element.
175
+ * @typeparam T - element type
176
+ * @param arr - the source array
177
+ */
27
178
  export declare function tail<T>(arr: readonly T[]): T[];
179
+ /**
180
+ * Returns a copy of the array without its last element.
181
+ * @typeparam T - element type
182
+ * @param arr - the source array
183
+ */
28
184
  export declare function init<T>(arr: readonly T[]): T[];
185
+ /**
186
+ * Internal helper providing an immutable `splice` using `toSpliced`.
187
+ * @internal
188
+ */
29
189
  export declare function _spliceNew<T>(arr: readonly T[], start: number, deleteCount: number, ...items: T[]): T[];
190
+ /**
191
+ * Internal helper providing an immutable `splice` via cloning.
192
+ * @internal
193
+ */
30
194
  export declare function _spliceOld<T>(arr: readonly T[], start: number, deleteCount: number, ...items: T[]): T[];
195
+ /**
196
+ * Immutable version of the array `.splice` command, always returning a new array.
197
+ * @typeparam T - element type
198
+ * @param arr - the source array
199
+ * @param start - start index
200
+ * @param deleteCount - number of elements to delete
201
+ * @param items - optional items to insert
202
+ */
31
203
  export declare const splice: typeof _spliceNew;
204
+ /**
205
+ * Returns a copy of a (potentially) sparse array preserving sparsity (skips holes).
206
+ * @typeparam T - element type
207
+ * @param arr - the source sparse array
208
+ */
32
209
  export declare function copySparse<T>(arr: readonly T[]): T[];
210
+ /**
211
+ * Returns a copy of a sparse array applying the given function to each present element, preserving holes.
212
+ * @typeparam T - source element type
213
+ * @typeparam T2 - result element type
214
+ * @param arr - the source sparse array
215
+ * @param f - mapping function
216
+ */
33
217
  export declare function mapSparse<T, T2>(arr: readonly T[], f: (value: T, index: number) => T2): T2[];