@rimbu/common 2.0.3 → 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 +10 -19
- package/package.json +3 -8
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|

|
|
9
9
|

|
|
10
10
|

|
|
11
|
-

|
|
12
11
|

|
|
13
12
|

|
|
14
13
|
|
|
@@ -94,7 +93,7 @@ const lazyValue = OptLazy(() => 1 + 2);
|
|
|
94
93
|
console.log(lazyValue); // 3
|
|
95
94
|
|
|
96
95
|
// Updates: accept either a value or an updater function
|
|
97
|
-
const next = Update(1, v => v + 1);
|
|
96
|
+
const next = Update(1, (v) => v + 1);
|
|
98
97
|
console.log(next); // 2
|
|
99
98
|
```
|
|
100
99
|
|
|
@@ -107,8 +106,8 @@ Try Rimbu (including `@rimbu/common`) live in the browser using the
|
|
|
107
106
|
|
|
108
107
|
### Exported Types & Utilities
|
|
109
108
|
|
|
110
|
-
| Name | Description
|
|
111
|
-
| ------------------ |
|
|
109
|
+
| Name | Description |
|
|
110
|
+
| ------------------ | -------------------------------------------------------------------------------------------------- |
|
|
112
111
|
| `CollectFun` | Types used by `collect`-style functions to map/filter in a single pass with skip & halt support. |
|
|
113
112
|
| `AsyncCollectFun` | Asynchronous version of `CollectFun`, returning `MaybePromise` of a collected value or skip token. |
|
|
114
113
|
| `Comp` | Interface and implementations for comparing values (ordering / sorting). |
|
|
@@ -119,11 +118,11 @@ Try Rimbu (including `@rimbu/common`) live in the browser using the
|
|
|
119
118
|
| `OptLazy` | A value or a function returning a value (lazy). |
|
|
120
119
|
| `OptLazyOr` | Like `OptLazy`, but can return a provided default value instead. |
|
|
121
120
|
| `AsyncOptLazy` | Potentially lazy and/or async values built on `OptLazy` + `MaybePromise`. |
|
|
122
|
-
| `MaybePromise<T>` | A value of type `T` or a `Promise<T>`.
|
|
121
|
+
| `MaybePromise<T>` | A value of type `T` or a `Promise<T>`. |
|
|
123
122
|
| `TraverseState` | Object to track progress & early termination in traversals. |
|
|
124
123
|
| `Update` | Value or updater function used to derive a new value from the old one. |
|
|
125
124
|
| `SuperOf`, `SubOf` | Type utilities for expressing upper/lower bounds between types. |
|
|
126
|
-
| `RelatedTo` | Type utility accepting related types where one extends the other.
|
|
125
|
+
| `RelatedTo` | Type utility accepting related types where one extends the other. |
|
|
127
126
|
| `ArrayNonEmpty` | Tuple type representing non-empty arrays. |
|
|
128
127
|
| `StringNonEmpty` | Type representing non-empty string types. |
|
|
129
128
|
| `ToJSON` | Helper interface for JSON-serializable wrapper objects. |
|
|
@@ -199,7 +198,7 @@ OptLazy(() => 1); // => 1
|
|
|
199
198
|
// With a default "other" value
|
|
200
199
|
OptLazyOr(1, 'a'); // => 1
|
|
201
200
|
OptLazyOr(() => 1, 'a'); // => 1
|
|
202
|
-
OptLazyOr(none => none, 'a'); // => 'a'
|
|
201
|
+
OptLazyOr((none) => none, 'a'); // => 'a'
|
|
203
202
|
```
|
|
204
203
|
|
|
205
204
|
### `Update`
|
|
@@ -209,7 +208,7 @@ import { Update } from '@rimbu/common';
|
|
|
209
208
|
|
|
210
209
|
Update(1, 2); // => 2
|
|
211
210
|
Update(1, () => 10); // => 10
|
|
212
|
-
Update(1, v => v + 1); // => 2
|
|
211
|
+
Update(1, (v) => v + 1); // => 2
|
|
213
212
|
```
|
|
214
213
|
|
|
215
214
|
### `AsyncOptLazy` and `MaybePromise`
|
|
@@ -291,16 +290,8 @@ npm install @rimbu/common
|
|
|
291
290
|
yarn add @rimbu/common
|
|
292
291
|
# or
|
|
293
292
|
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
|
-
}
|
|
293
|
+
# or
|
|
294
|
+
deno add npm:@rimbu/common
|
|
304
295
|
```
|
|
305
296
|
|
|
306
297
|
Then:
|
|
@@ -321,7 +312,7 @@ import { Eq } from '@rimbu/common/mod.ts';
|
|
|
321
312
|
- Part of the broader **Rimbu** collection ecosystem – interoperates with `@rimbu/collection-types`,
|
|
322
313
|
`@rimbu/hashed`, `@rimbu/ordered`, `@rimbu/stream`, and more.
|
|
323
314
|
- Main documentation: [rimbu.org](https://rimbu.org)
|
|
324
|
-
- Package docs: [Common docs](https://rimbu.org/docs/common/overview)
|
|
315
|
+
- Package docs: [Common docs](https://rimbu.org/docs/common/overview)
|
|
325
316
|
- API reference: [Common API](https://rimbu.org/api/rimbu/common)
|
|
326
317
|
|
|
327
318
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimbu/common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Common types and objects used in many other Rimbu packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"common",
|
|
@@ -52,17 +52,12 @@
|
|
|
52
52
|
"scripts": {
|
|
53
53
|
"b": "duel",
|
|
54
54
|
"build": "yarn clean && yarn bundle",
|
|
55
|
-
"build:deno": "yarn bundle:deno-prepare && yarn bundle:deno-convert && yarn bundle:deno-move && yarn bundle:deno-clean",
|
|
56
55
|
"bundle": "yarn bundle:cjs && yarn bundle:esm && yarn bundle:bun",
|
|
57
56
|
"bundle:bun": "node ../../config/bunnify.mjs -mode bun",
|
|
58
57
|
"bundle:cjs": "yarn bundle:cjs-prepare && yarn bundle:cjs-build && yarn bundle:cjs-clean",
|
|
59
58
|
"bundle:cjs-prepare": "node ../../config/bunnify.mjs -mode cjs",
|
|
60
59
|
"bundle:cjs-build": "tsc -p tsconfig.cjs.json",
|
|
61
60
|
"bundle:cjs-clean": "rimraf _cjs_prepare",
|
|
62
|
-
"bundle:deno-prepare": "node ../../config/prepare-denoify.mjs",
|
|
63
|
-
"bundle:deno-convert": "denoify --src _deno_prepare/src",
|
|
64
|
-
"bundle:deno-move": "rimraf ../../deno_dist/common && mv deno_dist ../../deno_dist/common",
|
|
65
|
-
"bundle:deno-clean": "rimraf _deno_prepare",
|
|
66
61
|
"bundle:esm": "tsc --p tsconfig.esm.json",
|
|
67
62
|
"clean": "rimraf dist",
|
|
68
63
|
"extract-api": "tsx ../../config/api-extractor.ts config/api-extractor.main.json",
|
|
@@ -80,7 +75,7 @@
|
|
|
80
75
|
"access": "public"
|
|
81
76
|
},
|
|
82
77
|
"dependencies": {
|
|
83
|
-
"tslib": "^2.
|
|
78
|
+
"tslib": "^2.8.1"
|
|
84
79
|
},
|
|
85
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "bc6bc82af86461c423ba459d6d9809efdd5ffd61"
|
|
86
81
|
}
|