@rimbu/common 2.0.1 → 2.0.2
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 +42 -42
- package/dist/bun/err.mts +1 -1
- package/dist/cjs/err.cjs +2 -2
- package/dist/cjs/err.cjs.map +1 -1
- package/dist/cjs/optlazy.cjs +2 -3
- package/dist/cjs/optlazy.cjs.map +1 -1
- package/dist/cjs/traverse-state.cjs +1 -2
- package/dist/cjs/traverse-state.cjs.map +1 -1
- package/dist/cjs/update.cjs +1 -2
- package/dist/cjs/update.cjs.map +1 -1
- package/package.json +5 -5
- package/src/err.mts +1 -1
package/README.md
CHANGED
|
@@ -8,62 +8,64 @@
|
|
|
8
8
|
|
|
9
9
|
# @rimbu/common
|
|
10
10
|
|
|
11
|
-
This package exports
|
|
11
|
+
Welcome to `@rimbu/common`! This package exports essential types and utilities that are widely used across various Rimbu packages. It provides a robust foundation for building efficient and reliable applications.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### Overview of most important Exported Types:
|
|
14
14
|
|
|
15
|
-
| Name | Description
|
|
16
|
-
| --------------- |
|
|
17
|
-
| `CollectFun` |
|
|
18
|
-
| `Comp` |
|
|
19
|
-
| `Eq` |
|
|
20
|
-
| `Err` |
|
|
21
|
-
| `FastIterable` |
|
|
22
|
-
| `IndexRange` |
|
|
23
|
-
| `OptLazy` |
|
|
24
|
-
| `Range` |
|
|
25
|
-
| `Reducer` |
|
|
26
|
-
| `TraverseState` |
|
|
27
|
-
| `Update` |
|
|
15
|
+
| Name | Description |
|
|
16
|
+
| --------------- | ----------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `CollectFun` | Types and values used in various `collect` methods within collections. |
|
|
18
|
+
| `Comp` | Interface and default implementations of comparison functions for ordering/sorting values. |
|
|
19
|
+
| `Eq` | Interface and default implementations of equality functions for checking value equality. |
|
|
20
|
+
| `Err` | Functions to easily create error-throwing behavior as fallback values. |
|
|
21
|
+
| `FastIterable` | An `Iterable` implementation that offers better performance than standard iterables. |
|
|
22
|
+
| `IndexRange` | Utilities for selecting 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 logic pieces that process data streams, which can be processed in parallel. |
|
|
26
|
+
| `TraverseState` | A utility for loops to maintain traversal state. |
|
|
27
|
+
| `Update` | A standard way to update a value. |
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
### Documentation
|
|
30
30
|
|
|
31
|
-
For complete documentation please visit the
|
|
31
|
+
For complete documentation, please visit the [Rimbu Docs](https://rimbu.org), or directly explore the [Rimbu Common API Docs](https://rimbu.org/api/rimbu/common).
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
### Try It Out
|
|
34
|
+
|
|
35
|
+
Experience `@rimbu/common` in action! [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) on CodeSandBox.
|
|
34
36
|
|
|
35
37
|
## Installation
|
|
36
38
|
|
|
37
39
|
### Compabitity
|
|
38
40
|
|
|
39
|
-
- [`Node
|
|
41
|
+
- [`Node` ](https://nodejs.org)
|
|
40
42
|
- [`Deno` ](https://deno.com/runtime)
|
|
41
|
-
- [`Bun
|
|
43
|
+
- [`Bun` ](https://bun.sh/)
|
|
42
44
|
- `Web` 
|
|
43
45
|
|
|
44
|
-
###
|
|
45
|
-
|
|
46
|
-
For convenience, all main types are also exported through [`@rimbu/core`](../core).
|
|
47
|
-
|
|
48
|
-
To install this package only:
|
|
49
|
-
|
|
50
|
-
For `yarn`:
|
|
46
|
+
### Package Managers
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
**Yarn:**
|
|
53
49
|
|
|
54
|
-
|
|
50
|
+
```sh
|
|
51
|
+
yarn add @rimbu/common
|
|
52
|
+
```
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
**npm:**
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
```sh
|
|
57
|
+
npm install @rimbu/common
|
|
58
|
+
```
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
**Bun:**
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
```sh
|
|
63
|
+
bun add @rimbu/common
|
|
64
|
+
```
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
### Deno Setup
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
Create or edit `import_map.json` in your project root:
|
|
67
69
|
|
|
68
70
|
```json
|
|
69
71
|
{
|
|
@@ -73,7 +75,7 @@ In the root folder of your project, create or edit a file called `import_map.jso
|
|
|
73
75
|
}
|
|
74
76
|
```
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
_Replace `x.y.z` with the desired version._
|
|
77
79
|
|
|
78
80
|
In this way you can use relative imports from Rimbu in your code, like so:
|
|
79
81
|
|
|
@@ -103,20 +105,18 @@ console.log(Eq.stringCaseInsentitive()('abc', 'AbC'));
|
|
|
103
105
|
|
|
104
106
|
## Author
|
|
105
107
|
|
|
106
|
-
[Arvid Nicolaas](https://github.com/vitoke)
|
|
108
|
+
Created and maintained by [Arvid Nicolaas](https://github.com/vitoke).
|
|
107
109
|
|
|
108
110
|
## Contributing
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
We welcome contributions! Please read our [Contributing guide](https://github.com/rimbu-org/rimbu/blob/main/CONTRIBUTING.md).
|
|
111
113
|
|
|
112
114
|
## Contributors
|
|
113
115
|
|
|
114
116
|
<img src = "https://contrib.rocks/image?repo=rimbu-org/rimbu"/>
|
|
115
117
|
|
|
116
|
-
|
|
118
|
+
_Made with [contributors-img](https://contrib.rocks)._
|
|
117
119
|
|
|
118
120
|
## License
|
|
119
121
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
See [LICENSE](./LICENSE) for more information.
|
|
122
|
+
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) for details.
|
package/dist/bun/err.mts
CHANGED
package/dist/cjs/err.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ErrBase =
|
|
3
|
+
exports.ErrBase = void 0;
|
|
4
|
+
exports.Err = Err;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
/**
|
|
6
7
|
* Throws an `Err.ForcedError` error when called.
|
|
@@ -14,7 +15,6 @@ var tslib_1 = require("tslib");
|
|
|
14
15
|
function Err() {
|
|
15
16
|
return ErrBase.msg('Err: Forced to throw error')();
|
|
16
17
|
}
|
|
17
|
-
exports.Err = Err;
|
|
18
18
|
var ErrBase;
|
|
19
19
|
(function (ErrBase) {
|
|
20
20
|
/**
|
package/dist/cjs/err.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"err.cjs","sourceRoot":"","sources":["../../_cjs_prepare/err.cts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"err.cjs","sourceRoot":"","sources":["../../_cjs_prepare/err.cts"],"names":[],"mappings":";;;AASA,kBAEC;;AAXD;;;;;;;;GAQG;AACH,SAAgB,GAAG;IACjB,OAAO,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,IAAiB,OAAO,CA6BvB;AA7BD,WAAiB,OAAO;IACtB;;OAEG;IACH;QACE,qBAAqB,OAAe;YAAf,YAAO,GAAP,OAAO,CAAQ;QAAG,CAAC;QAExC,sBAAI,6BAAI;iBAAR;gBACE,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YAC/B,CAAC;;;WAAA;QACH,kBAAC;IAAD,CAAC,AAND,IAMC;IANqB,mBAAW,cAMhC,CAAA;IAED;QAAiC,uCAAW;QAA5C;;QAA8C,CAAC;QAAD,kBAAC;IAAD,CAAC,AAA/C,CAAiC,WAAW,GAAG;IAAlC,mBAAW,cAAuB,CAAA;IAE/C;;;;;;;;;OASG;IACH,SAAgB,GAAG,CAAC,OAAe;QACjC,OAAO;YACL,MAAM,IAAI,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC;IACJ,CAAC;IAJe,WAAG,MAIlB,CAAA;AACH,CAAC,EA7BgB,OAAO,uBAAP,OAAO,QA6BvB"}
|
package/dist/cjs/optlazy.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OptLazy = OptLazy;
|
|
4
|
+
exports.OptLazyOr = OptLazyOr;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
/**
|
|
6
7
|
* Returns the value contained in an `OptLazy` instance of type T.
|
|
@@ -24,7 +25,6 @@ function OptLazy(optLazy) {
|
|
|
24
25
|
return optLazy.apply(void 0, tslib_1.__spreadArray([], tslib_1.__read(args), false));
|
|
25
26
|
return optLazy;
|
|
26
27
|
}
|
|
27
|
-
exports.OptLazy = OptLazy;
|
|
28
28
|
/**
|
|
29
29
|
* Returns the value contained in an `OptLazyOr` instance of type T, or the given
|
|
30
30
|
* `otherValue` if the lazy function returns it.
|
|
@@ -44,5 +44,4 @@ function OptLazyOr(optLazyOr, otherValue) {
|
|
|
44
44
|
return optLazyOr(otherValue);
|
|
45
45
|
return optLazyOr;
|
|
46
46
|
}
|
|
47
|
-
exports.OptLazyOr = OptLazyOr;
|
|
48
47
|
//# sourceMappingURL=optlazy.cjs.map
|
package/dist/cjs/optlazy.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optlazy.cjs","sourceRoot":"","sources":["../../_cjs_prepare/optlazy.cts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"optlazy.cjs","sourceRoot":"","sources":["../../_cjs_prepare/optlazy.cts"],"names":[],"mappings":";;AAoBA,0BAMC;AAwBD,8BAMC;;AAjDD;;;;;;;;;;;;GAYG;AACH,SAAgB,OAAO,CACrB,OAAsB;IACtB,cAAU;SAAV,UAAU,EAAV,qBAAU,EAAV,IAAU;QAAV,6BAAU;;IAEV,IAAI,OAAO,YAAY,QAAQ;QAAE,OAAO,OAAO,wDAAI,IAAI,WAAE;IACzD,OAAO,OAAO,CAAC;AACjB,CAAC;AAUD;;;;;;;;;;;;;GAaG;AACH,SAAgB,SAAS,CACvB,SAA0B,EAC1B,UAAa;IAEb,IAAI,SAAS,YAAY,QAAQ;QAAE,OAAO,SAAS,CAAC,UAAU,CAAC,CAAC;IAChE,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TraverseState =
|
|
3
|
+
exports.TraverseState = TraverseState;
|
|
4
4
|
var TraverseStateImpl = /** @class */ (function () {
|
|
5
5
|
function TraverseStateImpl(startIndex) {
|
|
6
6
|
var _this = this;
|
|
@@ -29,5 +29,4 @@ function TraverseState(startIndex) {
|
|
|
29
29
|
if (startIndex === void 0) { startIndex = 0; }
|
|
30
30
|
return new TraverseStateImpl(startIndex);
|
|
31
31
|
}
|
|
32
|
-
exports.TraverseState = TraverseState;
|
|
33
32
|
//# sourceMappingURL=traverse-state.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traverse-state.cjs","sourceRoot":"","sources":["../../_cjs_prepare/traverse-state.cts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"traverse-state.cjs","sourceRoot":"","sources":["../../_cjs_prepare/traverse-state.cts"],"names":[],"mappings":";;AAwDA,sCAEC;AA7BD;IAIE,2BAAqB,UAAkB;QAAvC,iBAEC;QAFoB,eAAU,GAAV,UAAU,CAAQ;QAFvC,WAAM,GAAG,KAAK,CAAC;QAUN,SAAI,GAAG;YACd,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACrB,CAAC,CAAC;QATA,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,qCAAS,GAAT;QACE,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;IAC7B,CAAC;IAMD,iCAAK,GAAL;QACE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IACH,wBAAC;AAAD,CAAC,AApBD,IAoBC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,UAAc;IAAd,2BAAA,EAAA,cAAc;IAC1C,OAAO,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/cjs/update.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Update =
|
|
3
|
+
exports.Update = Update;
|
|
4
4
|
/**
|
|
5
5
|
* Returns the result of given `update` parameter, where it can either directly give a new value,
|
|
6
6
|
* or it is a function receiving the given `value`, and returns a new value.
|
|
@@ -20,5 +20,4 @@ function Update(value, update) {
|
|
|
20
20
|
}
|
|
21
21
|
return update;
|
|
22
22
|
}
|
|
23
|
-
exports.Update = Update;
|
|
24
23
|
//# sourceMappingURL=update.cjs.map
|
package/dist/cjs/update.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.cjs","sourceRoot":"","sources":["../../_cjs_prepare/update.cts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.cjs","sourceRoot":"","sources":["../../_cjs_prepare/update.cts"],"names":[],"mappings":";;AAkBA,wBAKC;AAlBD;;;;;;;;;;;;GAYG;AACH,SAAgB,MAAM,CAAI,KAAQ,EAAE,MAAiB;IACnD,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAQ,MAA0B,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimbu/common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Common types and objects used in many other Rimbu packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"common",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"types": "./dist/cjs/index.d.cts",
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
|
37
|
+
"bun": "./dist/bun/index.mts",
|
|
37
38
|
"import": {
|
|
38
39
|
"types": "./dist/esm/index.d.mts",
|
|
39
40
|
"default": "./dist/esm/index.mjs"
|
|
@@ -41,8 +42,7 @@
|
|
|
41
42
|
"require": {
|
|
42
43
|
"types": "./dist/cjs/index.d.cts",
|
|
43
44
|
"default": "./dist/cjs/index.cjs"
|
|
44
|
-
}
|
|
45
|
-
"bun": "./dist/bun/index.mts"
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"bundle:deno-clean": "rimraf _deno_prepare",
|
|
66
66
|
"bundle:esm": "tsc --p tsconfig.esm.json",
|
|
67
67
|
"clean": "rimraf dist",
|
|
68
|
-
"extract-api": "
|
|
68
|
+
"extract-api": "tsx ../../config/api-extractor.ts config/api-extractor.main.json",
|
|
69
69
|
"format": "yarn format:base --write",
|
|
70
70
|
"format:base": "prettier \"{!CHANGELOG.md}|**/**/*.{ts,tsx,js,mts,mjs,json,md}\"",
|
|
71
71
|
"format:check": "yarn format:base --check",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"tslib": "^2.6.2"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "f18ddf964507dbd10790da3cd4deef8f455a178e"
|
|
86
86
|
}
|