@rimbu/common 2.0.1 → 2.0.3

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 CHANGED
@@ -1,122 +1,348 @@
1
1
  <p align="center">
2
- <img src="https://github.com/rimbu-org/rimbu/raw/main/assets/rimbu_logo.svg" />
2
+ <img src="https://github.com/rimbu-org/rimbu/raw/main/assets/rimbu_logo.svg" height="96" alt="Rimbu Logo" />
3
3
  </p>
4
4
 
5
- [![npm version](https://badge.fury.io/js/@rimbu%2Fcommon.svg)](https://www.npmjs.com/package/@rimbu/common) [![Deno](https://shield.deno.dev/x/rimbu)](http://deno.land/x/rimbu)
5
+ <div align="center">
6
6
 
7
- ![Licence](https://img.shields.io/github/license/rimbu-org/rimbu)
7
+ [![npm version](https://badge.fury.io/js/@rimbu%2Fcommon.svg)](https://www.npmjs.com/package/@rimbu/common)
8
+ ![License](https://img.shields.io/github/license/rimbu-org/rimbu)
9
+ ![Types Included](https://img.shields.io/badge/TypeScript-ready-blue)
10
+ ![Node](https://img.shields.io/badge/Node-18+-6DA55F?logo=node.js&logoColor=white)
11
+ ![Deno](https://shield.deno.dev/x/rimbu)
12
+ ![Bun](https://img.shields.io/badge/Bun-%23000000.svg)
13
+ ![ESM + CJS](https://img.shields.io/badge/modules-ESM%20%2B%20CJS-informational)
8
14
 
9
- # @rimbu/common
15
+ </div>
10
16
 
11
- This package exports common types and objects used in many other Rimbu packages.
17
+ # `@rimbu/common`
12
18
 
13
- Here is a brief overview:
19
+ **Shared utility types and helpers for the Rimbu ecosystem.**
14
20
 
15
- | Name | Description |
16
- | --------------- | -------------------------------------------------------------------------------------------------------- |
17
- | `CollectFun` | types and values used in various `collect` methods in the collection. |
18
- | `Comp` | an interface and default implementations of comparison functions to order/sort values. |
19
- | `Eq` | an interface and default implementations of equality functions to check value equality |
20
- | `Err` | functions to easily create error throwing behavior as fallback values |
21
- | `FastIterable` | an `Iterable` implementation that can be more performant than usual iterables |
22
- | `IndexRange` | utilities to select index ranges in indexed collections |
23
- | `OptLazy` | a utility to provide values that can optionally be lazy |
24
- | `Range` | utility types to specify ranges for comparable types |
25
- | `Reducer` | an API to create reusable pieces of logic that process streams of data that can be processed in parallel |
26
- | `TraverseState` | a utility for loops to maintain the traversal state |
27
- | `Update` | a standard way to update a value |
21
+ `@rimbu/common` provides the low-level **building blocks** used throughout Rimbu:
28
22
 
29
- Other than these values, there are a number of utility types that are exported that are also used throughout the collection.
23
+ - **Equality & comparison** helpers (`Eq`, `Comp`) for consistent value semantics.
24
+ - **Range & index utilities** (`Range`, `IndexRange`) for working with slices and windows.
25
+ - **Lazy values & updates** (`OptLazy`, `OptLazyOr`, `AsyncOptLazy`, `Update`) for ergonomic APIs.
26
+ - **Traversal helpers** (`CollectFun`, `TraverseState`) for efficient collection operations.
27
+ - **Type-level utilities** (`SuperOf`, `SubOf`, `RelatedTo`, `ArrayNonEmpty`, `StringNonEmpty`, `ToJSON`) for stronger TypeScript modelling.
30
28
 
31
- For complete documentation please visit the _[Rimbu Docs](https://rimbu.org)_, or directly see the _[Rimbu Common API Docs](https://rimbu.org/api/rimbu/common)_.
29
+ Use this package directly in your own code, or consume it indirectly when using other Rimbu packages.
32
30
 
33
- Or [Try Out Rimbu](https://codesandbox.io/s/github/vitoke/rimbu-sandbox/tree/main?previewwindow=console&view=split&editorsize=65&moduleview=1&module=/src/index.ts) in CodeSandBox.
31
+ ---
34
32
 
35
- ## Installation
33
+ ## Table of Contents
36
34
 
37
- ### Compabitity
35
+ 1. [Why `@rimbu/common`?](#why-rimbucommon)
36
+ 2. [Feature Highlights](#feature-highlights)
37
+ 3. [Quick Start](#quick-start)
38
+ 4. [Core Concepts & Types](#core-concepts--types)
39
+ 5. [Working with Equality & Comparison](#working-with-equality--comparison)
40
+ 6. [Lazy Values, Updates & Async](#lazy-values-updates--async)
41
+ 7. [Ranges & Indices](#ranges--indices)
42
+ 8. [Type Utilities](#type-utilities)
43
+ 9. [Installation](#installation)
44
+ 10. [Ecosystem & Links](#ecosystem--links)
45
+ 11. [Contributing](#contributing)
46
+ 12. [License](#license)
38
47
 
39
- - [`Node >= 16` ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?logo=node.js&logoColor=white)](https://nodejs.org)
40
- - [`Deno` ![Deno JS](https://img.shields.io/badge/deno%20js-000000?logo=deno&logoColor=white)](https://deno.com/runtime)
41
- - [`Bun >= 0.6.0` ![Bun](https://img.shields.io/badge/Bun-%23000000.svg?logoColor=white)](https://bun.sh/)
42
- - `Web` ![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?logoColor=white)
48
+ ---
43
49
 
44
- ### Yarn / NPM / Bun
50
+ ## Why `@rimbu/common`?
45
51
 
46
- For convenience, all main types are also exported through [`@rimbu/core`](../core).
52
+ Many Rimbu collections (and your own APIs) need **consistent behaviour** for:
47
53
 
48
- To install this package only:
54
+ - Comparing values (e.g. custom sort orders, structural vs reference equality).
55
+ - Handling optional or deferred values (lazy evaluation, async computations).
56
+ - Working with index or value ranges in a uniform way.
57
+ - Expressing richer type relationships in TypeScript.
49
58
 
50
- For `yarn`:
59
+ Instead of re‑implementing these patterns, `@rimbu/common` provides:
51
60
 
52
- > `yarn add @rimbu/common`
61
+ - **Well-tested primitives** shared across all Rimbu packages.
62
+ - **Reusable utilities** you can depend on directly in your own libraries and apps.
63
+ - **Type-safe building blocks** that integrate smoothly with the rest of the Rimbu ecosystem.
53
64
 
54
- For `npm`:
65
+ ---
55
66
 
56
- > `npm i @rimbu/common`
67
+ ## Feature Highlights
57
68
 
58
- For `bun`:
69
+ - **Pluggable equality & comparison** – `Eq` and `Comp` instances for primitives, objects, iterables, JSON, case-insensitive strings, and more.
70
+ - **Lazy & async helpers** – `OptLazy`, `OptLazyOr`, `AsyncOptLazy`, `MaybePromise` to keep APIs flexible without sacrificing clarity.
71
+ - **Declarative ranges** – `Range<T>` and `IndexRange` to describe open/closed and offset-based ranges in a single, typed shape.
72
+ - **Traversal utilities** – `CollectFun` and `TraverseState` for customizable, short‑circuitable traversals.
73
+ - **Type-level helpers** – utilities like `ArrayNonEmpty`, `StringNonEmpty`, and `ToJSON` to express invariants and serializable shapes.
59
74
 
60
- > `bun add @rimbu/common`
75
+ ---
61
76
 
62
- ### Deno
77
+ ## Quick Start
63
78
 
64
- For Deno, the following approach is recommended:
79
+ ```ts
80
+ import { Eq, Comp, OptLazy, Update } from '@rimbu/common';
65
81
 
66
- In the root folder of your project, create or edit a file called `import_map.json` with the following contents (where you should replace `x.y.z` with the desired version of Rimbu):
82
+ // Equality: deep structural comparison
83
+ const eq = Eq.anyDeepEq<Record<string, unknown>>();
84
+ console.log(eq({ a: 1, b: 2 }, { b: 2, a: 1 }));
85
+ // => true
67
86
 
68
- ```json
69
- {
70
- "imports": {
71
- "@rimbu/": "https://deno.land/x/rimbu@x.y.z/"
72
- }
73
- }
87
+ // Comparison: natural number ordering
88
+ const numComp = Comp.numberComp();
89
+ console.log(numComp.compare(3, 5) < 0);
90
+ // => true
91
+
92
+ // Lazy values: compute only when needed
93
+ const lazyValue = OptLazy(() => 1 + 2);
94
+ console.log(lazyValue); // 3
95
+
96
+ // Updates: accept either a value or an updater function
97
+ const next = Update(1, v => v + 1);
98
+ console.log(next); // 2
74
99
  ```
75
100
 
76
- **Note: The trailing slashes are important!**
101
+ Try Rimbu (including `@rimbu/common`) live in the browser using the
102
+ [Rimbu Sandbox on CodeSandbox](https://codesandbox.io/s/github/vitoke/rimbu-sandbox/tree/main?previewwindow=console&view=split&editorsize=65&moduleview=1&module=/src/index.ts).
103
+
104
+ ---
77
105
 
78
- In this way you can use relative imports from Rimbu in your code, like so:
106
+ ## Core Concepts & Types
107
+
108
+ ### Exported Types & Utilities
109
+
110
+ | Name | Description |
111
+ | ------------------ | --------------------------------------------------------------------------------------------------- |
112
+ | `CollectFun` | Types used by `collect`-style functions to map/filter in a single pass with skip & halt support. |
113
+ | `AsyncCollectFun` | Asynchronous version of `CollectFun`, returning `MaybePromise` of a collected value or skip token. |
114
+ | `Comp` | Interface and implementations for comparing values (ordering / sorting). |
115
+ | `Eq` | Interface and implementations for checking value equality. |
116
+ | `Err`, `ErrBase` | Helpers to throw consistent custom errors from fallback handlers. |
117
+ | `IndexRange` | Range specification for numeric indices (e.g. slicing arrays or collections). |
118
+ | `Range<T>` | Range specification for ordered values of type `T`. |
119
+ | `OptLazy` | A value or a function returning a value (lazy). |
120
+ | `OptLazyOr` | Like `OptLazy`, but can return a provided default value instead. |
121
+ | `AsyncOptLazy` | Potentially lazy and/or async values built on `OptLazy` + `MaybePromise`. |
122
+ | `MaybePromise<T>` | A value of type `T` or a `Promise<T>`. |
123
+ | `TraverseState` | Object to track progress & early termination in traversals. |
124
+ | `Update` | Value or updater function used to derive a new value from the old one. |
125
+ | `SuperOf`, `SubOf` | Type utilities for expressing upper/lower bounds between types. |
126
+ | `RelatedTo` | Type utility accepting related types where one extends the other. |
127
+ | `ArrayNonEmpty` | Tuple type representing non-empty arrays. |
128
+ | `StringNonEmpty` | Type representing non-empty string types. |
129
+ | `ToJSON` | Helper interface for JSON-serializable wrapper objects. |
130
+
131
+ See the full [Common API reference](https://rimbu.org/api/rimbu/common) for all members and overloads.
132
+
133
+ ---
134
+
135
+ ## Working with Equality & Comparison
136
+
137
+ ### Equality with `Eq`
79
138
 
80
139
  ```ts
81
- import { List } from '@rimbu/core/mod.ts';
82
- import { HashMap } from '@rimbu/hashed/mod.ts';
140
+ import { Eq } from '@rimbu/common';
141
+
142
+ // Deep structural equality
143
+ const deepEq = Eq.anyDeepEq<Record<string, unknown>>();
144
+ console.log(deepEq({ a: 1, b: 2 }, { b: 2, a: 1 }));
145
+ // => true
146
+
147
+ // Shallow equality: one level into objects / iterables
148
+ const shallowEq = Eq.anyShallowEq<Record<string, unknown>>();
149
+ console.log(shallowEq({ a: 1, b: 2 }, { b: 2, a: 1 }));
150
+ // => true
151
+
152
+ // Flat equality: composed values compared using Object.is
153
+ const flatEq = Eq.anyFlatEq<Record<string, unknown>>();
154
+ console.log(flatEq({ a: 1, b: 2 }, { b: 2, a: 1 }));
155
+ // => false
156
+
157
+ // Case-insensitive string equality
158
+ const ci = Eq.stringCaseInsentitiveEq();
159
+ console.log(ci('AbC', 'aBc'));
160
+ // => true
83
161
  ```
84
162
 
85
- Note that for sub-packages, due to conversion limitations it is needed to import the `index.ts` instead of `mod.ts`, like so:
163
+ ### Comparison with `Comp`
86
164
 
87
165
  ```ts
88
- import { HashMap } from '@rimbu/hashed/map/index.ts';
166
+ import { Comp } from '@rimbu/common';
167
+
168
+ // Numbers: natural ordering with special handling for NaN and infinities
169
+ const numberComp = Comp.numberComp();
170
+ numberComp.compare(3, 5); // < 0
171
+
172
+ // Strings: locale-aware comparison
173
+ const stringComp = Comp.stringComp('en');
174
+ stringComp.compare('a', 'b'); // < 0
175
+
176
+ // Deep comparison of arbitrary values
177
+ const anyDeepComp = Comp.anyDeepComp<unknown>();
178
+ anyDeepComp.compare({ a: 1 }, { a: 1 }); // 0
179
+
180
+ // Convert a comparison into an equality function
181
+ const objectEq = Comp.toEq(Comp.objectComp());
182
+ console.log(objectEq({ a: 1, b: 2 }, { b: 2, a: 1 }));
183
+ // => true
89
184
  ```
90
185
 
91
- To run your script (let's assume the entry point is in `src/main.ts`):
186
+ ---
92
187
 
93
- `deno run --import-map import_map.json src/main.ts`
188
+ ## Lazy Values, Updates & Async
94
189
 
95
- ## Usage
190
+ ### `OptLazy` and `OptLazyOr`
96
191
 
97
192
  ```ts
98
- import { Eq } from '@rimbu/common';
193
+ import { OptLazy, OptLazyOr } from '@rimbu/common';
99
194
 
100
- console.log(Eq.stringCaseInsentitive()('abc', 'AbC'));
101
- // => true
195
+ // Eager or lazy values
196
+ OptLazy(1); // => 1
197
+ OptLazy(() => 1); // => 1
198
+
199
+ // With a default "other" value
200
+ OptLazyOr(1, 'a'); // => 1
201
+ OptLazyOr(() => 1, 'a'); // => 1
202
+ OptLazyOr(none => none, 'a'); // => 'a'
203
+ ```
204
+
205
+ ### `Update`
206
+
207
+ ```ts
208
+ import { Update } from '@rimbu/common';
209
+
210
+ Update(1, 2); // => 2
211
+ Update(1, () => 10); // => 10
212
+ Update(1, v => v + 1); // => 2
213
+ ```
214
+
215
+ ### `AsyncOptLazy` and `MaybePromise`
216
+
217
+ ```ts
218
+ import { AsyncOptLazy } from '@rimbu/common';
219
+
220
+ // Get a value or promised value
221
+ await AsyncOptLazy.toPromise(1); // Promise(1)
222
+ await AsyncOptLazy.toPromise(() => 1); // Promise(1)
223
+ await AsyncOptLazy.toPromise(async () => 1); // Promise(1)
224
+ await AsyncOptLazy.toPromise(Promise.resolve(1)); // Promise(1)
102
225
  ```
103
226
 
104
- ## Author
227
+ ---
105
228
 
106
- [Arvid Nicolaas](https://github.com/vitoke)
229
+ ## Ranges & Indices
230
+
231
+ ### `Range<T>`
232
+
233
+ ```ts
234
+ import { Range } from '@rimbu/common';
235
+
236
+ // Inclusive start, exclusive end
237
+ const r1: Range<number> = { start: [0, true], end: [10, false] };
238
+
239
+ // Only end (inclusive by default)
240
+ const r2: Range<number> = { end: 5 };
241
+
242
+ // Normalize for easier handling
243
+ const normalized = Range.getNormalizedRange(r1);
244
+ // => { start: [0, true], end: [10, false] }
245
+ ```
246
+
247
+ ### `IndexRange`
248
+
249
+ ```ts
250
+ import { IndexRange } from '@rimbu/common';
251
+
252
+ const ir: IndexRange = { start: [0, true], amount: 3 };
253
+
254
+ // Extract concrete indices for a given length
255
+ IndexRange.getIndicesFor(ir, 10); // [0, 2]
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Type Utilities
261
+
262
+ ```ts
263
+ import type {
264
+ SuperOf,
265
+ SubOf,
266
+ RelatedTo,
267
+ ArrayNonEmpty,
268
+ StringNonEmpty,
269
+ ToJSON,
270
+ } from '@rimbu/common';
271
+
272
+ type A = SuperOf<string, 'a' | 'b'>; // string
273
+ type B = SubOf<'a' | 'b', string>; // 'a' | 'b'
274
+ type R = RelatedTo<'a', string>; // 'a' | string
275
+
276
+ type NonEmptyNumbers = ArrayNonEmpty<number>; // [number, ...number[]]
277
+ type NonEmptyString = StringNonEmpty<'a' | ''>; // 'a'
278
+
279
+ interface UserJSON extends ToJSON<{ id: number }, 'User'> {}
280
+ ```
281
+
282
+ ---
283
+
284
+ ## Installation
285
+
286
+ ### Node / Bun / npm / Yarn
287
+
288
+ ```sh
289
+ npm install @rimbu/common
290
+ # or
291
+ yarn add @rimbu/common
292
+ # or
293
+ bun add @rimbu/common
294
+ ```
295
+
296
+ ### Deno (import map)
297
+
298
+ ```jsonc
299
+ {
300
+ "imports": {
301
+ "@rimbu/": "https://deno.land/x/rimbu@<version>/"
302
+ }
303
+ }
304
+ ```
305
+
306
+ Then:
307
+
308
+ ```ts
309
+ import { Eq } from '@rimbu/common/mod.ts';
310
+ ```
311
+
312
+ ### Browser / ESM
313
+
314
+ `@rimbu/common` ships both **ESM** and **CJS** builds. Use it with any modern bundler
315
+ (Vite, Webpack, esbuild, Bun, etc.) or directly in Node ESM projects.
316
+
317
+ ---
318
+
319
+ ## Ecosystem & Links
320
+
321
+ - Part of the broader **Rimbu** collection ecosystem – interoperates with `@rimbu/collection-types`,
322
+ `@rimbu/hashed`, `@rimbu/ordered`, `@rimbu/stream`, and more.
323
+ - Main documentation: [rimbu.org](https://rimbu.org)
324
+ - Package docs: [Common docs](https://rimbu.org/docs/common/overview)
325
+ - API reference: [Common API](https://rimbu.org/api/rimbu/common)
326
+
327
+ ---
107
328
 
108
329
  ## Contributing
109
330
 
110
- Feel very welcome to contribute to further improve Rimbu. Please read our [Contributing guide](https://github.com/rimbu-org/rimbu/blob/main/CONTRIBUTING.md).
331
+ We welcome contributions! See the
332
+ [Contributing guide](https://github.com/rimbu-org/rimbu/blob/main/CONTRIBUTING.md) for details.
111
333
 
112
- ## Contributors
334
+ <img src="https://contrib.rocks/image?repo=rimbu-org/rimbu" alt="Contributors" />
113
335
 
114
- <img src = "https://contrib.rocks/image?repo=rimbu-org/rimbu"/>
336
+ _Made with [contributors-img](https://contrib.rocks)._
115
337
 
116
- Made with [contributors-img](https://contrib.rocks).
338
+ ---
117
339
 
118
340
  ## License
119
341
 
120
- Licensed under the MIT License, Copyright © 2020-present Arvid Nicolaas.
342
+ MIT © Rimbu contributors. See [LICENSE](./LICENSE) for details.
343
+
344
+ ---
345
+
346
+ ## Attributions
121
347
 
122
- See [LICENSE](./LICENSE) for more information.
348
+ Created and maintained by [Arvid Nicolaas](https://github.com/vitoke). Logo © Rimbu.
package/dist/bun/eq.mts CHANGED
@@ -4,6 +4,15 @@
4
4
  export type Eq<T> = (v1: T, v2: T) => boolean;
5
5
 
6
6
  export namespace Eq {
7
+ /**
8
+ * Converts any given `value` to a string representation that is stable for equality
9
+ * and ordering comparisons.
10
+ *
11
+ * For primitive values and objects with a custom `toString` implementation, it uses
12
+ * `String(value)`. For plain objects with the default `Object.prototype.toString`
13
+ * implementation, it uses `JSON.stringify(value)` instead.
14
+ * @param value - the value to convert
15
+ */
7
16
  export function convertAnyToString(value: any): string {
8
17
  if (
9
18
  typeof value !== 'object' ||
@@ -146,7 +155,7 @@ export namespace Eq {
146
155
  /**
147
156
  * Returns an Eq instance that checks equality of objects containing property values of type V by iteratively
148
157
  * applying given `valueEq` to each of the object's property values.
149
- * @typeparam - the object property value type
158
+ * @typeparam V - the object property value type
150
159
  * @param valueEq - (optional) the Eq instance to use to compare property values
151
160
  * @example
152
161
  * ```ts
@@ -228,7 +237,7 @@ export namespace Eq {
228
237
  * @typeparam T - the value type
229
238
  * @example
230
239
  * ```ts
231
- * const eq = anyFlatEq()
240
+ * const eq = Eq.anyFlatEq()
232
241
  * console.log(eq(1, 'a'))
233
242
  * // => false
234
243
  * console.log(eq({ a: 1, b: 2 }, { b: 2, a: 1 }))
@@ -246,7 +255,7 @@ export namespace Eq {
246
255
  * @typeparam T - the value type
247
256
  * @example
248
257
  * ```ts
249
- * const eq = anyFlatEq()
258
+ * const eq = Eq.anyShallowEq()
250
259
  * console.log(eq(1, 'a'))
251
260
  * // => false
252
261
  * console.log(eq({ a: 1, b: 2 }, { b: 2, a: 1 }))
@@ -267,7 +276,7 @@ export namespace Eq {
267
276
  * @typeparam T - the value type
268
277
  * @example
269
278
  * ```ts
270
- * const eq = anyFlatEq()
279
+ * const eq = Eq.anyDeepEq()
271
280
  * console.log(eq(1, 'a'))
272
281
  * // => false
273
282
  * console.log(eq({ a: 1, b: 2 }, { b: 2, a: 1 }))
@@ -359,6 +368,18 @@ export namespace Eq {
359
368
  const _anyToStringEq: Eq<any> = (v1, v2) =>
360
369
  convertAnyToString(v1) === convertAnyToString(v2);
361
370
 
371
+ /**
372
+ * Returns an Eq instance that considers two values equal when their string
373
+ * representations, as returned by `Eq.convertAnyToString`, are equal.
374
+ * @example
375
+ * ```ts
376
+ * const eq = Eq.anyToStringEq()
377
+ * console.log(eq({ a: 1 }, { a: 1 }))
378
+ * // => true
379
+ * console.log(eq({ a: 1 }, { a: 2 }))
380
+ * // => false
381
+ * ```
382
+ */
362
383
  export function anyToStringEq(): Eq<any> {
363
384
  return _anyToStringEq;
364
385
  }
package/dist/bun/err.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Throws an `Err.ForcedError` error when called.
2
+ * Throws an `ErrBase.ForcedError` error when called.
3
3
  * @example
4
4
  * ```ts
5
5
  * const emptyMap = HashMap.empty<number, string>()
6
6
  * emptyMap.get(5, Err);
7
- * // throws: Err.CustomError(message: 'Err: forced to throw error')
7
+ * // throws: ErrBase.ForcedError(message: 'Err: Forced to throw error')
8
8
  * ```
9
9
  */
10
10
  export function Err(): never {
@@ -18,11 +18,14 @@ export namespace ErrBase {
18
18
  export abstract class CustomError {
19
19
  constructor(readonly message: string) {}
20
20
 
21
- get name() {
21
+ get name(): string {
22
22
  return this.constructor.name;
23
23
  }
24
24
  }
25
25
 
26
+ /**
27
+ * Error type that is thrown by `Err` and the functions returned by `ErrBase.msg`.
28
+ */
26
29
  export class ForcedError extends CustomError {}
27
30
 
28
31
  /**
@@ -32,7 +35,7 @@ export namespace ErrBase {
32
35
  * ```ts
33
36
  * const emptyMap = HashMap.empty<number, string>()
34
37
  * emptyMap.get(5, ErrBase.msg('not found'));
35
- * // throws: Err.CustomError(message: 'not found')
38
+ * // throws: ErrBase.ForcedError(message: 'not found')
36
39
  * ```
37
40
  */
38
41
  export function msg(message: string): () => never {
@@ -1,7 +1,13 @@
1
1
  /**
2
2
  * @packageDocumentation
3
3
  *
4
- * The `@rimbu/common` package provides many commonly used types and utilities that can also be of use to Rimbu users.<br/>
4
+ * The `@rimbu/common` package provides shared equality and comparison helpers, range and index
5
+ * utilities, lazy and async value helpers, traversal utilities, and rich type‑level helpers used
6
+ * throughout the Rimbu ecosystem.<br/>
7
+ * Use it when you need well‑tested primitives like `Eq`, `Comp`, `Range`, `OptLazy`, `AsyncOptLazy`,
8
+ * or advanced type utilities in your own code, or when building on top of other Rimbu packages.<br/>
9
+ * See the [Common docs](https://rimbu.org/docs/common/overview) and
10
+ * [API reference](https://rimbu.org/api/rimbu/common) for more information.
5
11
  */
6
12
 
7
13
  export * from './internal.mts';
package/dist/cjs/eq.cjs CHANGED
@@ -4,6 +4,15 @@ exports.Eq = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var Eq;
6
6
  (function (Eq) {
7
+ /**
8
+ * Converts any given `value` to a string representation that is stable for equality
9
+ * and ordering comparisons.
10
+ *
11
+ * For primitive values and objects with a custom `toString` implementation, it uses
12
+ * `String(value)`. For plain objects with the default `Object.prototype.toString`
13
+ * implementation, it uses `JSON.stringify(value)` instead.
14
+ * @param value - the value to convert
15
+ */
7
16
  function convertAnyToString(value) {
8
17
  if (typeof value !== 'object' ||
9
18
  null === value ||
@@ -135,7 +144,7 @@ var Eq;
135
144
  /**
136
145
  * Returns an Eq instance that checks equality of objects containing property values of type V by iteratively
137
146
  * applying given `valueEq` to each of the object's property values.
138
- * @typeparam - the object property value type
147
+ * @typeparam V - the object property value type
139
148
  * @param valueEq - (optional) the Eq instance to use to compare property values
140
149
  * @example
141
150
  * ```ts
@@ -206,7 +215,7 @@ var Eq;
206
215
  * @typeparam T - the value type
207
216
  * @example
208
217
  * ```ts
209
- * const eq = anyFlatEq()
218
+ * const eq = Eq.anyFlatEq()
210
219
  * console.log(eq(1, 'a'))
211
220
  * // => false
212
221
  * console.log(eq({ a: 1, b: 2 }, { b: 2, a: 1 }))
@@ -224,7 +233,7 @@ var Eq;
224
233
  * @typeparam T - the value type
225
234
  * @example
226
235
  * ```ts
227
- * const eq = anyFlatEq()
236
+ * const eq = Eq.anyShallowEq()
228
237
  * console.log(eq(1, 'a'))
229
238
  * // => false
230
239
  * console.log(eq({ a: 1, b: 2 }, { b: 2, a: 1 }))
@@ -245,7 +254,7 @@ var Eq;
245
254
  * @typeparam T - the value type
246
255
  * @example
247
256
  * ```ts
248
- * const eq = anyFlatEq()
257
+ * const eq = Eq.anyDeepEq()
249
258
  * console.log(eq(1, 'a'))
250
259
  * // => false
251
260
  * console.log(eq({ a: 1, b: 2 }, { b: 2, a: 1 }))
@@ -333,6 +342,18 @@ var Eq;
333
342
  var _anyToStringEq = function (v1, v2) {
334
343
  return convertAnyToString(v1) === convertAnyToString(v2);
335
344
  };
345
+ /**
346
+ * Returns an Eq instance that considers two values equal when their string
347
+ * representations, as returned by `Eq.convertAnyToString`, are equal.
348
+ * @example
349
+ * ```ts
350
+ * const eq = Eq.anyToStringEq()
351
+ * console.log(eq({ a: 1 }, { a: 1 }))
352
+ * // => true
353
+ * console.log(eq({ a: 1 }, { a: 2 }))
354
+ * // => false
355
+ * ```
356
+ */
336
357
  function anyToStringEq() {
337
358
  return _anyToStringEq;
338
359
  }
@@ -1 +1 @@
1
- {"version":3,"file":"eq.cjs","sourceRoot":"","sources":["../../_cjs_prepare/eq.cts"],"names":[],"mappings":";;;;AAKA,IAAiB,EAAE,CAgZlB;AAhZD,WAAiB,EAAE;IACjB,SAAgB,kBAAkB,CAAC,KAAU;QAC3C,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,IAAI,KAAK,KAAK;YACd,CAAC,CAAC,UAAU,IAAI,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