@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.
- package/README.md +165 -35
- package/dist/bun/arr.mts +184 -19
- package/dist/bun/entry.mts +14 -2
- package/dist/bun/index.mts +10 -0
- package/dist/bun/rimbu-error.mts +25 -0
- package/dist/bun/token.mts +7 -0
- package/dist/cjs/arr.cjs +184 -19
- package/dist/cjs/arr.cjs.map +1 -1
- package/dist/cjs/arr.d.cts +184 -0
- package/dist/cjs/entry.cjs +14 -2
- package/dist/cjs/entry.cjs.map +1 -1
- package/dist/cjs/entry.d.cts +14 -0
- package/dist/cjs/index.cjs +10 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +9 -0
- package/dist/cjs/rimbu-error.cjs +25 -0
- package/dist/cjs/rimbu-error.cjs.map +1 -1
- package/dist/cjs/rimbu-error.d.cts +25 -0
- package/dist/cjs/token.cjs +4 -0
- package/dist/cjs/token.cjs.map +1 -1
- package/dist/cjs/token.d.cts +7 -0
- package/dist/esm/arr.d.mts +184 -0
- package/dist/esm/arr.mjs +184 -19
- package/dist/esm/arr.mjs.map +1 -1
- package/dist/esm/entry.d.mts +14 -0
- package/dist/esm/entry.mjs +14 -2
- package/dist/esm/entry.mjs.map +1 -1
- package/dist/esm/index.d.mts +9 -0
- package/dist/esm/index.mjs +10 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/rimbu-error.d.mts +25 -0
- package/dist/esm/rimbu-error.mjs +25 -0
- package/dist/esm/rimbu-error.mjs.map +1 -1
- package/dist/esm/token.d.mts +7 -0
- package/dist/esm/token.mjs +4 -0
- package/dist/esm/token.mjs.map +1 -1
- package/package.json +4 -9
- package/src/arr.mts +184 -19
- package/src/entry.mts +14 -2
- package/src/index.mts +10 -0
- package/src/rimbu-error.mts +25 -0
- package/src/token.mts +7 -0
package/dist/esm/arr.mjs
CHANGED
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
import { TraverseState, Update } 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 function _appendNew(array, value) {
|
|
3
11
|
return array.toSpliced(array.length, 0, value);
|
|
4
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Internal helper that appends a value by cloning and pushing (legacy fallback).
|
|
15
|
+
* @internal
|
|
16
|
+
* @typeparam T - the array element type
|
|
17
|
+
* @param array - the source array (not mutated)
|
|
18
|
+
* @param value - the value to append
|
|
19
|
+
* @returns a new non-empty array with the value at the end
|
|
20
|
+
*/
|
|
5
21
|
export function _appendOld(array, value) {
|
|
6
22
|
const clone = array.slice();
|
|
7
23
|
clone.push(value);
|
|
8
24
|
return clone;
|
|
9
25
|
}
|
|
10
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Returns a copy of the array with the given value appended.
|
|
28
|
+
* Chooses an implementation depending on environment capabilities.
|
|
29
|
+
* @typeparam T - the array element type
|
|
30
|
+
* @param array - the source array (not mutated)
|
|
31
|
+
* @param value - the value to append
|
|
32
|
+
* @returns a new array with the value at the end
|
|
33
|
+
*/
|
|
11
34
|
export const append = `toSpliced` in Array.prototype ? _appendNew : _appendOld;
|
|
12
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Returns the concatenation of two arrays, reusing an input array when the other is empty.
|
|
37
|
+
* @typeparam T - the array element type
|
|
38
|
+
* @param first - the first array
|
|
39
|
+
* @param second - the second array
|
|
40
|
+
* @returns a new array containing all elements of both arrays (or one of the originals if the other is empty)
|
|
41
|
+
*/
|
|
13
42
|
export function concat(first, second) {
|
|
14
43
|
if (first.length === 0)
|
|
15
44
|
return second;
|
|
@@ -17,12 +46,20 @@ export function concat(first, second) {
|
|
|
17
46
|
return first;
|
|
18
47
|
return first.concat(second);
|
|
19
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Internal helper to create a reversed copy using modern `toReversed` with optional slicing.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
20
53
|
export function _reverseNew(array, start, end) {
|
|
21
54
|
const source = undefined !== start || undefined !== end
|
|
22
55
|
? array.slice(start ?? 0, (end ?? array.length - 1) + 1)
|
|
23
56
|
: array;
|
|
24
57
|
return source.toReversed();
|
|
25
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Internal helper to create a reversed copy using manual iteration (legacy fallback).
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
26
63
|
export function _reverseOld(array, start, end) {
|
|
27
64
|
const _start = start ?? 0;
|
|
28
65
|
const _end = end ?? array.length - 1;
|
|
@@ -34,9 +71,23 @@ export function _reverseOld(array, start, end) {
|
|
|
34
71
|
res[resIndex--] = array[arrayIndex];
|
|
35
72
|
return res;
|
|
36
73
|
}
|
|
37
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Returns a copy of the array (or a slice) with elements in reversed order.
|
|
76
|
+
* @typeparam T - array element type
|
|
77
|
+
* @param array - the source array
|
|
78
|
+
* @param start - optional start index (inclusive)
|
|
79
|
+
* @param end - optional end index (inclusive)
|
|
80
|
+
*/
|
|
38
81
|
export const reverse = 'toReversed' in Array.prototype ? _reverseNew : _reverseOld;
|
|
39
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Performs the given function for each element of the array, optionally in reverse order.
|
|
84
|
+
* Halting is supported through the provided `TraverseState`.
|
|
85
|
+
* @typeparam T - element type
|
|
86
|
+
* @param array - the source array
|
|
87
|
+
* @param f - callback receiving (value, sequential index, halt)
|
|
88
|
+
* @param state - traversal state (created if omitted)
|
|
89
|
+
* @param reversed - whether to traverse in reverse order
|
|
90
|
+
*/
|
|
40
91
|
export function forEach(array, f, state = TraverseState(), reversed = false) {
|
|
41
92
|
if (state.halted)
|
|
42
93
|
return;
|
|
@@ -55,7 +106,15 @@ export function forEach(array, f, state = TraverseState(), reversed = false) {
|
|
|
55
106
|
}
|
|
56
107
|
}
|
|
57
108
|
}
|
|
58
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Returns a copy of the array where the given function is applied to each element.
|
|
111
|
+
* Supports an index offset useful for composed traversals.
|
|
112
|
+
* @typeparam T - source element type
|
|
113
|
+
* @typeparam R - result element type
|
|
114
|
+
* @param array - the source array
|
|
115
|
+
* @param f - the mapping function
|
|
116
|
+
* @param indexOffset - optional start index value passed to `f`
|
|
117
|
+
*/
|
|
59
118
|
export function map(array, f, indexOffset = 0) {
|
|
60
119
|
if (indexOffset === 0) {
|
|
61
120
|
// without offset, can use standard array map
|
|
@@ -70,7 +129,14 @@ export function map(array, f, indexOffset = 0) {
|
|
|
70
129
|
}
|
|
71
130
|
return result;
|
|
72
131
|
}
|
|
73
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Returns a copy of the array where the given function is applied to each element in reverse order.
|
|
134
|
+
* @typeparam T - source element type
|
|
135
|
+
* @typeparam R - result element type
|
|
136
|
+
* @param array - the source array
|
|
137
|
+
* @param f - the mapping function
|
|
138
|
+
* @param indexOffset - optional index offset passed to `f`
|
|
139
|
+
*/
|
|
74
140
|
export function reverseMap(array, f, indexOffset = 0) {
|
|
75
141
|
const result = [];
|
|
76
142
|
let index = indexOffset;
|
|
@@ -80,24 +146,53 @@ export function reverseMap(array, f, indexOffset = 0) {
|
|
|
80
146
|
result[resultIndex++] = f(array[arrayIndex], index++);
|
|
81
147
|
return result;
|
|
82
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Internal helper to prepend a value using `toSpliced`.
|
|
151
|
+
* @internal
|
|
152
|
+
*/
|
|
83
153
|
export function _prependNew(array, value) {
|
|
84
154
|
return array.toSpliced(0, 0, value);
|
|
85
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Internal helper to prepend a value using legacy cloning.
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
86
160
|
export function _prependOld(array, value) {
|
|
87
161
|
const clone = array.slice();
|
|
88
162
|
clone.unshift(value);
|
|
89
163
|
return clone;
|
|
90
164
|
}
|
|
91
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Returns a copy of the array with the given value inserted at the start.
|
|
167
|
+
* @typeparam T - element type
|
|
168
|
+
* @param array - the source array
|
|
169
|
+
* @param value - value to insert at index 0
|
|
170
|
+
*/
|
|
92
171
|
export const prepend = `toSpliced` in Array.prototype ? _prependNew : _prependOld;
|
|
172
|
+
/**
|
|
173
|
+
* Internal helper to obtain the last element using modern `at`.
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
93
176
|
export function _lastNew(arr) {
|
|
94
177
|
return arr.at(-1);
|
|
95
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Internal helper to obtain the last element using index arithmetic.
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
96
183
|
export function _lastOld(arr) {
|
|
97
184
|
return arr[arr.length - 1];
|
|
98
185
|
}
|
|
99
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Returns the last element of the array.
|
|
188
|
+
* @typeparam T - element type
|
|
189
|
+
* @param arr - the array
|
|
190
|
+
*/
|
|
100
191
|
export const last = `at` in Array.prototype ? _lastNew : _lastOld;
|
|
192
|
+
/**
|
|
193
|
+
* Internal helper implementing an immutable index update via `with`.
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
101
196
|
export function _updateNew(arr, index, updater) {
|
|
102
197
|
if (index < 0 || index >= arr.length) {
|
|
103
198
|
return arr;
|
|
@@ -109,6 +204,10 @@ export function _updateNew(arr, index, updater) {
|
|
|
109
204
|
}
|
|
110
205
|
return arr.with(index, newValue);
|
|
111
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Internal helper implementing an immutable index update via cloning.
|
|
209
|
+
* @internal
|
|
210
|
+
*/
|
|
112
211
|
export function _updateOld(arr, index, updater) {
|
|
113
212
|
if (index < 0 || index >= arr.length) {
|
|
114
213
|
return arr;
|
|
@@ -122,9 +221,19 @@ export function _updateOld(arr, index, updater) {
|
|
|
122
221
|
newArr[index] = newValue;
|
|
123
222
|
return newArr;
|
|
124
223
|
}
|
|
125
|
-
|
|
126
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Returns a copy of the array where the element at the given index is replaced using the provided updater.
|
|
226
|
+
* If the result value is identical (by `Object.is`) the original array is returned.
|
|
227
|
+
* @typeparam T - element type
|
|
228
|
+
* @param arr - the source array
|
|
229
|
+
* @param index - the index to update
|
|
230
|
+
* @param updater - value or function update description
|
|
231
|
+
*/
|
|
127
232
|
export const update = `with` in Array.prototype ? _updateNew : _updateOld;
|
|
233
|
+
/**
|
|
234
|
+
* Internal helper applying a modifier function via `with`.
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
128
237
|
export function _modNew(arr, index, f) {
|
|
129
238
|
if (index < 0 || index >= arr.length) {
|
|
130
239
|
return arr;
|
|
@@ -136,6 +245,10 @@ export function _modNew(arr, index, f) {
|
|
|
136
245
|
}
|
|
137
246
|
return arr.with(index, newValue);
|
|
138
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Internal helper applying a modifier function via cloning.
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
139
252
|
export function _modOld(arr, index, f) {
|
|
140
253
|
if (index < 0 || index >= arr.length) {
|
|
141
254
|
return arr;
|
|
@@ -149,38 +262,85 @@ export function _modOld(arr, index, f) {
|
|
|
149
262
|
newArr[index] = newValue;
|
|
150
263
|
return newArr;
|
|
151
264
|
}
|
|
152
|
-
|
|
153
|
-
|
|
265
|
+
/**
|
|
266
|
+
* Returns a copy of the array where the element at the given index is transformed by a modifier function.
|
|
267
|
+
* If the result value is identical (by `Object.is`) the original array is returned.
|
|
268
|
+
* @typeparam T - element type
|
|
269
|
+
* @param arr - the source array
|
|
270
|
+
* @param index - the index to modify
|
|
271
|
+
* @param f - modifier function receiving the current value
|
|
272
|
+
*/
|
|
154
273
|
export const mod = `with` in Array.prototype ? _modNew : _modOld;
|
|
274
|
+
/**
|
|
275
|
+
* Internal helper for inserting a value using `toSpliced`.
|
|
276
|
+
* @internal
|
|
277
|
+
*/
|
|
155
278
|
export function _insertNew(arr, index, value) {
|
|
156
279
|
return arr.toSpliced(index, 0, value);
|
|
157
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Internal helper for inserting a value using legacy `splice` on a clone.
|
|
283
|
+
* @internal
|
|
284
|
+
*/
|
|
158
285
|
export function _insertOld(arr, index, value) {
|
|
159
286
|
const clone = arr.slice();
|
|
160
287
|
clone.splice(index, 0, value);
|
|
161
288
|
return clone;
|
|
162
289
|
}
|
|
163
|
-
|
|
290
|
+
/**
|
|
291
|
+
* Returns a copy of the array where at the given index the provided value is inserted.
|
|
292
|
+
* @typeparam T - element type
|
|
293
|
+
* @param arr - the source array
|
|
294
|
+
* @param index - insertion index
|
|
295
|
+
* @param value - value to insert
|
|
296
|
+
*/
|
|
164
297
|
export const insert = `toSpliced` in Array.prototype ? _insertNew : _insertOld;
|
|
165
|
-
|
|
298
|
+
/**
|
|
299
|
+
* Returns a copy of the array without its first element.
|
|
300
|
+
* @typeparam T - element type
|
|
301
|
+
* @param arr - the source array
|
|
302
|
+
*/
|
|
166
303
|
export function tail(arr) {
|
|
167
304
|
return arr.slice(1);
|
|
168
305
|
}
|
|
169
|
-
|
|
306
|
+
/**
|
|
307
|
+
* Returns a copy of the array without its last element.
|
|
308
|
+
* @typeparam T - element type
|
|
309
|
+
* @param arr - the source array
|
|
310
|
+
*/
|
|
170
311
|
export function init(arr) {
|
|
171
312
|
return arr.slice(0, arr.length - 1);
|
|
172
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Internal helper providing an immutable `splice` using `toSpliced`.
|
|
316
|
+
* @internal
|
|
317
|
+
*/
|
|
173
318
|
export function _spliceNew(arr, start, deleteCount, ...items) {
|
|
174
319
|
return arr.toSpliced(start, deleteCount, ...items);
|
|
175
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Internal helper providing an immutable `splice` via cloning.
|
|
323
|
+
* @internal
|
|
324
|
+
*/
|
|
176
325
|
export function _spliceOld(arr, start, deleteCount, ...items) {
|
|
177
326
|
const clone = arr.slice();
|
|
178
327
|
clone.splice(start, deleteCount, ...items);
|
|
179
328
|
return clone;
|
|
180
329
|
}
|
|
181
|
-
|
|
330
|
+
/**
|
|
331
|
+
* Immutable version of the array `.splice` command, always returning a new array.
|
|
332
|
+
* @typeparam T - element type
|
|
333
|
+
* @param arr - the source array
|
|
334
|
+
* @param start - start index
|
|
335
|
+
* @param deleteCount - number of elements to delete
|
|
336
|
+
* @param items - optional items to insert
|
|
337
|
+
*/
|
|
182
338
|
export const splice = `toSpliced` in Array.prototype ? _spliceNew : _spliceOld;
|
|
183
|
-
|
|
339
|
+
/**
|
|
340
|
+
* Returns a copy of a (potentially) sparse array preserving sparsity (skips holes).
|
|
341
|
+
* @typeparam T - element type
|
|
342
|
+
* @param arr - the source sparse array
|
|
343
|
+
*/
|
|
184
344
|
export function copySparse(arr) {
|
|
185
345
|
const clone = [];
|
|
186
346
|
for (const key in arr) {
|
|
@@ -188,8 +348,13 @@ export function copySparse(arr) {
|
|
|
188
348
|
}
|
|
189
349
|
return clone;
|
|
190
350
|
}
|
|
191
|
-
|
|
192
|
-
|
|
351
|
+
/**
|
|
352
|
+
* Returns a copy of a sparse array applying the given function to each present element, preserving holes.
|
|
353
|
+
* @typeparam T - source element type
|
|
354
|
+
* @typeparam T2 - result element type
|
|
355
|
+
* @param arr - the source sparse array
|
|
356
|
+
* @param f - mapping function
|
|
357
|
+
*/
|
|
193
358
|
export function mapSparse(arr, f) {
|
|
194
359
|
const result = Array(arr.length);
|
|
195
360
|
for (const key in arr) {
|
package/dist/esm/arr.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arr.mjs","sourceRoot":"","sources":["../../src/arr.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,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,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;AAE/E;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAI,GAAiB;IAC7C,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,KAAK,MAAM,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,MAAM,UAAU,SAAS,CACvB,GAAiB,EACjB,CAAkC;IAElC,MAAM,MAAM,GAAS,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAEvC,KAAK,MAAM,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"}
|
package/dist/esm/entry.d.mts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the first element of a 2-tuple.
|
|
3
|
+
* @typeparam K - the first element type
|
|
4
|
+
* @typeparam V - the second element type
|
|
5
|
+
* @param entry - the tuple
|
|
6
|
+
* @returns the first element
|
|
7
|
+
*/
|
|
1
8
|
export declare function first<K, V>(entry: readonly [K, V]): K;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the second element of a 2-tuple.
|
|
11
|
+
* @typeparam K - the first element type
|
|
12
|
+
* @typeparam V - the second element type
|
|
13
|
+
* @param entry - the tuple
|
|
14
|
+
* @returns the second element
|
|
15
|
+
*/
|
|
2
16
|
export declare function second<K, V>(entry: readonly [K, V]): V;
|
package/dist/esm/entry.mjs
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Returns the first element of a 2-tuple.
|
|
3
|
+
* @typeparam K - the first element type
|
|
4
|
+
* @typeparam V - the second element type
|
|
5
|
+
* @param entry - the tuple
|
|
6
|
+
* @returns the first element
|
|
7
|
+
*/
|
|
2
8
|
export function first(entry) {
|
|
3
9
|
return entry[0];
|
|
4
10
|
}
|
|
5
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Returns the second element of a 2-tuple.
|
|
13
|
+
* @typeparam K - the first element type
|
|
14
|
+
* @typeparam V - the second element type
|
|
15
|
+
* @param entry - the tuple
|
|
16
|
+
* @returns the second element
|
|
17
|
+
*/
|
|
6
18
|
export function second(entry) {
|
|
7
19
|
return entry[1];
|
|
8
20
|
}
|
package/dist/esm/entry.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.mjs","sourceRoot":"","sources":["../../src/entry.mts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"entry.mjs","sourceRoot":"","sources":["../../src/entry.mts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAO,KAAsB;IAChD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAO,KAAsB;IACjD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* The `@rimbu/base` package provides foundational immutable array utilities, tuple helpers,
|
|
5
|
+
* plain‑object type predicates and structured error types that power all other Rimbu collections.<br/>
|
|
6
|
+
* Use it directly when you need low‑level, performance‑aware primitives for persistent data
|
|
7
|
+
* structures without pulling in the higher‑level collection packages.<br/>
|
|
8
|
+
* See the Rimbu docs and API reference for more information.
|
|
9
|
+
*/
|
|
1
10
|
export * as Arr from './arr.mjs';
|
|
2
11
|
export * as Entry from './entry.mjs';
|
|
3
12
|
export * as RimbuError from './rimbu-error.mjs';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* The `@rimbu/base` package provides foundational immutable array utilities, tuple helpers,
|
|
5
|
+
* plain‑object type predicates and structured error types that power all other Rimbu collections.<br/>
|
|
6
|
+
* Use it directly when you need low‑level, performance‑aware primitives for persistent data
|
|
7
|
+
* structures without pulling in the higher‑level collection packages.<br/>
|
|
8
|
+
* See the Rimbu docs and API reference for more information.
|
|
9
|
+
*/
|
|
1
10
|
export * as Arr from './arr.mjs';
|
|
2
11
|
export * as Entry from './entry.mjs';
|
|
3
12
|
export * as RimbuError from './rimbu-error.mjs';
|
|
4
13
|
export * from './plain-object.mjs';
|
|
14
|
+
// Internal exports (may change without notice)
|
|
5
15
|
export * from './internal.mjs';
|
|
6
16
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,oBAAoB,CAAC;AAEnC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/index.mts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,cAAc,oBAAoB,CAAC;AAEnC,+CAA+C;AAC/C,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
import { ErrBase } from '@rimbu/common';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when an operation assumes a collection is non-empty but it is empty.
|
|
4
|
+
*/
|
|
2
5
|
export declare class EmptyCollectionAssumedNonEmptyError extends ErrBase.CustomError {
|
|
3
6
|
constructor();
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when a builder is modified while it is being iterated.
|
|
10
|
+
*/
|
|
5
11
|
export declare class ModifiedBuilderWhileLoopingOverItError extends ErrBase.CustomError {
|
|
6
12
|
constructor();
|
|
7
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Error indicating an unexpected internal state. Users are encouraged to file an issue.
|
|
16
|
+
*/
|
|
8
17
|
export declare class InvalidStateError extends ErrBase.CustomError {
|
|
9
18
|
constructor();
|
|
10
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Error indicating incorrect usage of the API.
|
|
22
|
+
*/
|
|
11
23
|
export declare class InvalidUsageError extends ErrBase.CustomError {
|
|
12
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Throws an `EmptyCollectionAssumedNonEmptyError`.
|
|
27
|
+
*/
|
|
13
28
|
export declare function throwEmptyCollectionAssumedNonEmptyError(): never;
|
|
29
|
+
/**
|
|
30
|
+
* Throws a `ModifiedBuilderWhileLoopingOverItError`.
|
|
31
|
+
*/
|
|
14
32
|
export declare function throwModifiedBuilderWhileLoopingOverItError(): never;
|
|
33
|
+
/**
|
|
34
|
+
* Throws an `InvalidStateError`.
|
|
35
|
+
*/
|
|
15
36
|
export declare function throwInvalidStateError(): never;
|
|
37
|
+
/**
|
|
38
|
+
* Throws an `InvalidUsageError` with the provided message.
|
|
39
|
+
* @param msg - context message describing the invalid usage
|
|
40
|
+
*/
|
|
16
41
|
export declare function throwInvalidUsageError(msg: string): never;
|
package/dist/esm/rimbu-error.mjs
CHANGED
|
@@ -1,30 +1,55 @@
|
|
|
1
1
|
import { ErrBase } from '@rimbu/common';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when an operation assumes a collection is non-empty but it is empty.
|
|
4
|
+
*/
|
|
2
5
|
export class EmptyCollectionAssumedNonEmptyError extends ErrBase.CustomError {
|
|
3
6
|
constructor() {
|
|
4
7
|
super('empty collection was assumbed to be non-empty');
|
|
5
8
|
}
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when a builder is modified while it is being iterated.
|
|
12
|
+
*/
|
|
7
13
|
export class ModifiedBuilderWhileLoopingOverItError extends ErrBase.CustomError {
|
|
8
14
|
constructor() {
|
|
9
15
|
super('an attempt was made to modify a builder while looping over it');
|
|
10
16
|
}
|
|
11
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Error indicating an unexpected internal state. Users are encouraged to file an issue.
|
|
20
|
+
*/
|
|
12
21
|
export class InvalidStateError extends ErrBase.CustomError {
|
|
13
22
|
constructor() {
|
|
14
23
|
super("something happend that shouldn't happen, please consider creating an issue");
|
|
15
24
|
}
|
|
16
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Error indicating incorrect usage of the API.
|
|
28
|
+
*/
|
|
17
29
|
export class InvalidUsageError extends ErrBase.CustomError {
|
|
18
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Throws an `EmptyCollectionAssumedNonEmptyError`.
|
|
33
|
+
*/
|
|
19
34
|
export function throwEmptyCollectionAssumedNonEmptyError() {
|
|
20
35
|
throw new EmptyCollectionAssumedNonEmptyError();
|
|
21
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Throws a `ModifiedBuilderWhileLoopingOverItError`.
|
|
39
|
+
*/
|
|
22
40
|
export function throwModifiedBuilderWhileLoopingOverItError() {
|
|
23
41
|
throw new ModifiedBuilderWhileLoopingOverItError();
|
|
24
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Throws an `InvalidStateError`.
|
|
45
|
+
*/
|
|
25
46
|
export function throwInvalidStateError() {
|
|
26
47
|
throw new InvalidStateError();
|
|
27
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Throws an `InvalidUsageError` with the provided message.
|
|
51
|
+
* @param msg - context message describing the invalid usage
|
|
52
|
+
*/
|
|
28
53
|
export function throwInvalidUsageError(msg) {
|
|
29
54
|
throw new InvalidUsageError(msg);
|
|
30
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rimbu-error.mjs","sourceRoot":"","sources":["../../src/rimbu-error.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,OAAO,mCAAoC,SAAQ,OAAO,CAAC,WAAW;IAC1E;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACzD,CAAC;CACF;AAED,MAAM,OAAO,sCAAuC,SAAQ,OAAO,CAAC,WAAW;IAC7E;QACE,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACzE,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,WAAW;IACxD;QACE,KAAK,CACH,4EAA4E,CAC7E,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,WAAW;CAAG;AAE7D,MAAM,UAAU,wCAAwC;IACtD,MAAM,IAAI,mCAAmC,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,2CAA2C;IACzD,MAAM,IAAI,sCAAsC,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,MAAM,IAAI,iBAAiB,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC"}
|
|
1
|
+
{"version":3,"file":"rimbu-error.mjs","sourceRoot":"","sources":["../../src/rimbu-error.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,OAAO,CAAC,WAAW;IAC1E;QACE,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACzD,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,OAAO,CAAC,WAAW;IAC7E;QACE,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACzE,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,WAAW;IACxD;QACE,KAAK,CACH,4EAA4E,CAC7E,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,WAAW;CAAG;AAE7D;;GAEG;AACH,MAAM,UAAU,wCAAwC;IACtD,MAAM,IAAI,mCAAmC,EAAE,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2CAA2C;IACzD,MAAM,IAAI,sCAAsC,EAAE,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,IAAI,iBAAiB,EAAE,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,MAAM,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/esm/token.d.mts
CHANGED
|
@@ -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 declare const Token: unique symbol;
|
|
6
|
+
/**
|
|
7
|
+
* Type alias representing the Token symbol.
|
|
8
|
+
*/
|
|
2
9
|
export type Token = typeof Token;
|
package/dist/esm/token.mjs
CHANGED
package/dist/esm/token.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.mjs","sourceRoot":"","sources":["../../src/token.mts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"token.mjs","sourceRoot":"","sources":["../../src/token.mts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimbu/base",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Utilities to implement Rimbu collections",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"types": "./dist/cjs/index.d.cts",
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|
|
35
|
-
"bun": "./dist/bun/
|
|
35
|
+
"bun": "./dist/bun/index.mts",
|
|
36
36
|
"import": {
|
|
37
37
|
"types": "./dist/esm/index.d.mts",
|
|
38
38
|
"default": "./dist/esm/index.mjs"
|
|
@@ -49,17 +49,12 @@
|
|
|
49
49
|
],
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "yarn clean && yarn bundle",
|
|
52
|
-
"build:deno": "yarn bundle:deno-prepare && yarn bundle:deno-convert && yarn bundle:deno-move && yarn bundle:deno-clean",
|
|
53
52
|
"bundle": "yarn bundle:cjs && yarn bundle:esm && yarn bundle:bun",
|
|
54
53
|
"bundle:bun": "node ../../config/bunnify.mjs -mode bun",
|
|
55
54
|
"bundle:cjs": "yarn bundle:cjs-prepare && yarn bundle:cjs-build && yarn bundle:cjs-clean",
|
|
56
55
|
"bundle:cjs-prepare": "node ../../config/bunnify.mjs -mode cjs",
|
|
57
56
|
"bundle:cjs-build": "tsc -p tsconfig.cjs.json",
|
|
58
57
|
"bundle:cjs-clean": "rimraf _cjs_prepare",
|
|
59
|
-
"bundle:deno-prepare": "node ../../config/prepare-denoify.mjs",
|
|
60
|
-
"bundle:deno-convert": "denoify --src _deno_prepare/src",
|
|
61
|
-
"bundle:deno-move": "rimraf ../../deno_dist/base && mv deno_dist ../../deno_dist/base",
|
|
62
|
-
"bundle:deno-clean": "rimraf _deno_prepare",
|
|
63
58
|
"bundle:esm": "tsc --p tsconfig.esm.json",
|
|
64
59
|
"clean": "rimraf dist",
|
|
65
60
|
"format": "yarn format:base --write",
|
|
@@ -73,10 +68,10 @@
|
|
|
73
68
|
"typecheck": "tsc"
|
|
74
69
|
},
|
|
75
70
|
"dependencies": {
|
|
76
|
-
"@rimbu/common": "^2.0.
|
|
71
|
+
"@rimbu/common": "^2.0.4"
|
|
77
72
|
},
|
|
78
73
|
"publishConfig": {
|
|
79
74
|
"access": "public"
|
|
80
75
|
},
|
|
81
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "bc6bc82af86461c423ba459d6d9809efdd5ffd61"
|
|
82
77
|
}
|