@ixfx/process 0.38.0 → 0.40.0
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/LICENSE +81 -0
- package/README.md +17 -0
- package/dist/src/if-undefined.d.ts +0 -1
- package/dist/src/if-undefined.d.ts.map +1 -1
- package/dist/src/if-undefined.js +0 -1
- package/dist/src/seen.d.ts +3 -0
- package/dist/src/seen.d.ts.map +1 -1
- package/dist/src/seen.js +8 -5
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -19,3 +19,84 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Mersenne Twister
|
|
26
|
+
https://github.com/jawj/mtwist
|
|
27
|
+
© Copyright 2014 – 2021 George MacKerron
|
|
28
|
+
MIT License
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
Ramer Douglas Peucker implementation
|
|
33
|
+
|
|
34
|
+
Marius Karthaus
|
|
35
|
+
http://www.LowVoice.nl
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
The MIT License (MIT)
|
|
40
|
+
|
|
41
|
+
Copyright © 2022 github.com/pushkine/
|
|
42
|
+
|
|
43
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
44
|
+
|
|
45
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
46
|
+
|
|
47
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
collections/BinaryTreeNode
|
|
52
|
+
collections/BinarySearchTree
|
|
53
|
+
collections/TreeNode
|
|
54
|
+
https://github.com/amejiarosario/dsa.js-data-structures-algorithms-javascript
|
|
55
|
+
|
|
56
|
+
MIT License
|
|
57
|
+
|
|
58
|
+
Copyright (c) 2019 Adrian Mejia
|
|
59
|
+
|
|
60
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
61
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
62
|
+
in the Software without restriction, including without limitation the rights
|
|
63
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
64
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
65
|
+
furnished to do so, subject to the following conditions:
|
|
66
|
+
|
|
67
|
+
The above copyright notice and this permission notice shall be included in all
|
|
68
|
+
copies or substantial portions of the Software.
|
|
69
|
+
|
|
70
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
71
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
72
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
73
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
74
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
75
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
76
|
+
SOFTWARE.
|
|
77
|
+
|
|
78
|
+
----
|
|
79
|
+
|
|
80
|
+
Package: colorjs.io
|
|
81
|
+
|
|
82
|
+
MIT License
|
|
83
|
+
|
|
84
|
+
Copyright (c) 2021 Lea Verou, Chris Lilley
|
|
85
|
+
|
|
86
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
87
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
88
|
+
in the Software without restriction, including without limitation the rights
|
|
89
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
90
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
91
|
+
furnished to do so, subject to the following conditions:
|
|
92
|
+
|
|
93
|
+
The above copyright notice and this permission notice shall be included in all
|
|
94
|
+
copies or substantial portions of the Software.
|
|
95
|
+
|
|
96
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
97
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
98
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
99
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
100
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
101
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
102
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
The process module contains functions for orchestrating a simple series of data transformations.
|
|
2
|
+
|
|
3
|
+
Use `flow` to create this orchestration:
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
const p = flow(
|
|
7
|
+
(value:string) => value.toUpperCase(), // Convert to uppercase
|
|
8
|
+
(value:string) => value.at(0) === 'A') // If first letter is an A, return true
|
|
9
|
+
);
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Once created, the flow can be invoked with an input value:
|
|
13
|
+
```js
|
|
14
|
+
p('apple'); // True
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Each function in the processing flow takes one input and returns one result. There are a few in-built functions as well. Some of these are stateful, remembering previous values that have been processed (eg `seenToUndefined`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"if-undefined.d.ts","sourceRoot":"","sources":["../../src/if-undefined.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"if-undefined.d.ts","sourceRoot":"","sources":["../../src/if-undefined.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,IAAI,IAC5E,OAAO,GAAG,gBAKnB;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,MAC3B,OAAO,GAAG,GAAG,SAAS,KAEZ,GAAG,CAEtB;AACD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,IAAI,IAC3C,OAAO,GAAG,gCAInB"}
|
package/dist/src/if-undefined.js
CHANGED
package/dist/src/seen.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Process } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* If a value is same as the previous value, _undefined_ is emitted instead.
|
|
4
|
+
*
|
|
4
5
|
* @param eq Equality function. If not specified, === semantics are used.
|
|
5
6
|
* @returns
|
|
6
7
|
*/
|
|
7
8
|
export declare function seenLastToUndefined<TIn>(eq?: (a: TIn, b: TIn) => boolean): Process<TIn, TIn | undefined>;
|
|
8
9
|
/**
|
|
9
10
|
* If a value is same as any previously-seen value, _undefined_ is emitted instead.
|
|
11
|
+
*
|
|
10
12
|
* It stores all previous values and compares against them for each new value.
|
|
11
13
|
* This would likely be not very efficient compared to {@link seenToUndefinedByKey} which uses a one-time computed
|
|
12
14
|
* key and efficient storage of only the keys (using a Set).
|
|
@@ -17,6 +19,7 @@ export declare function seenLastToUndefined<TIn>(eq?: (a: TIn, b: TIn) => boolea
|
|
|
17
19
|
export declare function seenToUndefined<TIn>(eq?: (a: TIn, b: TIn) => boolean): Process<TIn, TIn | undefined>;
|
|
18
20
|
/**
|
|
19
21
|
* If a value is the same as any previously-seen value, _undefined_ is emitted instead.
|
|
22
|
+
*
|
|
20
23
|
* This version uses a function to create a string key of the object, by default JSON.stringify.
|
|
21
24
|
* Thus we don't need to store all previously seen objects, just their keys.
|
|
22
25
|
*
|
package/dist/src/seen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seen.d.ts","sourceRoot":"","sources":["../../src/seen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C
|
|
1
|
+
{"version":3,"file":"seen.d.ts","sourceRoot":"","sources":["../../src/seen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG1C;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC,CAUxG;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC,CAWpG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CAAC,CAU1G"}
|
package/dist/src/seen.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { isEqualDefault, toStringDefault } from "./util.js";
|
|
2
2
|
/**
|
|
3
3
|
* If a value is same as the previous value, _undefined_ is emitted instead.
|
|
4
|
+
*
|
|
4
5
|
* @param eq Equality function. If not specified, === semantics are used.
|
|
5
6
|
* @returns
|
|
6
7
|
*/
|
|
7
8
|
export function seenLastToUndefined(eq) {
|
|
8
|
-
if (eq === undefined)
|
|
9
|
+
if (typeof eq === `undefined`)
|
|
9
10
|
eq = isEqualDefault;
|
|
10
11
|
let lastValue;
|
|
11
12
|
return (value) => {
|
|
@@ -18,6 +19,7 @@ export function seenLastToUndefined(eq) {
|
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* If a value is same as any previously-seen value, _undefined_ is emitted instead.
|
|
22
|
+
*
|
|
21
23
|
* It stores all previous values and compares against them for each new value.
|
|
22
24
|
* This would likely be not very efficient compared to {@link seenToUndefinedByKey} which uses a one-time computed
|
|
23
25
|
* key and efficient storage of only the keys (using a Set).
|
|
@@ -26,8 +28,8 @@ export function seenLastToUndefined(eq) {
|
|
|
26
28
|
* @returns
|
|
27
29
|
*/
|
|
28
30
|
export function seenToUndefined(eq) {
|
|
29
|
-
|
|
30
|
-
if (eq === undefined)
|
|
31
|
+
const seen = [];
|
|
32
|
+
if (typeof eq === `undefined`)
|
|
31
33
|
eq = isEqualDefault;
|
|
32
34
|
return (value) => {
|
|
33
35
|
if (value === undefined)
|
|
@@ -42,6 +44,7 @@ export function seenToUndefined(eq) {
|
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* If a value is the same as any previously-seen value, _undefined_ is emitted instead.
|
|
47
|
+
*
|
|
45
48
|
* This version uses a function to create a string key of the object, by default JSON.stringify.
|
|
46
49
|
* Thus we don't need to store all previously seen objects, just their keys.
|
|
47
50
|
*
|
|
@@ -52,8 +55,8 @@ export function seenToUndefined(eq) {
|
|
|
52
55
|
* @returns
|
|
53
56
|
*/
|
|
54
57
|
export function seenToUndefinedByKey(toString) {
|
|
55
|
-
|
|
56
|
-
if (toString === undefined)
|
|
58
|
+
const seen = new Set();
|
|
59
|
+
if (typeof toString === `undefined`)
|
|
57
60
|
toString = toStringDefault;
|
|
58
61
|
return (value) => {
|
|
59
62
|
if (value === undefined)
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixfx/process",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"files": [
|
|
8
8
|
"dist/"
|
|
9
9
|
],
|
|
10
|
+
"dependencies": {},
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/src/index.d.ts",
|
|
@@ -17,6 +18,5 @@
|
|
|
17
18
|
"import": "./dist/src/basic.js"
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
|
-
"dependencies": {},
|
|
21
21
|
"main": "dist/src/index.js"
|
|
22
22
|
}
|