@thi.ng/transducers 9.2.9 → 9.2.11
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/CHANGELOG.md +10 -1
- package/README.md +3 -2
- package/benchmark.js +5 -4
- package/package.json +19 -13
- package/partition-time.js +5 -4
- package/throttle-time.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-12-27T14:11:37Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,15 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [9.2.11](https://github.com/thi-ng/umbrella/tree/@thi.ng/transducers@9.2.11) (2024-12-27)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update time-based transducers ([54ad446](https://github.com/thi-ng/umbrella/commit/54ad446))
|
|
17
|
+
- add [@thi.ng/timestamp](https://github.com/thi-ng/umbrella/tree/main/packages/timestamp) micro dependency
|
|
18
|
+
- update timestamp handling (more precise in some contexts)
|
|
19
|
+
- update `benchmark()`, `partitionTime()`, `throttleTime()`
|
|
20
|
+
|
|
12
21
|
## [9.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/transducers@9.2.0) (2024-08-19)
|
|
13
22
|
|
|
14
23
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 200 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -150,7 +150,7 @@ For Node.js REPL:
|
|
|
150
150
|
const tx = await import("@thi.ng/transducers");
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 9.
|
|
153
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 9.09 KB
|
|
154
154
|
|
|
155
155
|
## Dependencies
|
|
156
156
|
|
|
@@ -162,6 +162,7 @@ Package sizes (brotli'd, pre-treeshake): ESM: 9.05 KB
|
|
|
162
162
|
- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/develop/packages/errors)
|
|
163
163
|
- [@thi.ng/math](https://github.com/thi-ng/umbrella/tree/develop/packages/math)
|
|
164
164
|
- [@thi.ng/random](https://github.com/thi-ng/umbrella/tree/develop/packages/random)
|
|
165
|
+
- [@thi.ng/timestamp](https://github.com/thi-ng/umbrella/tree/develop/packages/timestamp)
|
|
165
166
|
|
|
166
167
|
Note: @thi.ng/api is in _most_ cases a type-only import (not used at runtime)
|
|
167
168
|
|
package/benchmark.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { isIterable } from "@thi.ng/checks/is-iterable";
|
|
2
|
+
import { now, timeDiff } from "@thi.ng/timestamp";
|
|
2
3
|
import { compR } from "./compr.js";
|
|
3
4
|
import { iterator1 } from "./iterator.js";
|
|
4
5
|
function benchmark(src) {
|
|
5
6
|
return isIterable(src) ? iterator1(benchmark(), src) : (rfn) => {
|
|
6
7
|
const r = rfn[2];
|
|
7
|
-
let prev =
|
|
8
|
+
let prev = now();
|
|
8
9
|
return compR(rfn, (acc, _) => {
|
|
9
|
-
const t =
|
|
10
|
-
const
|
|
10
|
+
const t = now();
|
|
11
|
+
const delta = timeDiff(prev, t);
|
|
11
12
|
prev = t;
|
|
12
|
-
return r(acc,
|
|
13
|
+
return r(acc, delta);
|
|
13
14
|
});
|
|
14
15
|
};
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/transducers",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.11",
|
|
4
4
|
"description": "Collection of ~170 lightweight, composable transducers, reducers, generators, iterators for functional data transformations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
{
|
|
20
20
|
"type": "patreon",
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "liberapay",
|
|
25
|
+
"url": "https://liberapay.com/thi.ng"
|
|
22
26
|
}
|
|
23
27
|
],
|
|
24
28
|
"author": "Karsten Schmidt (https://thi.ng)",
|
|
@@ -40,19 +44,20 @@
|
|
|
40
44
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
41
45
|
},
|
|
42
46
|
"dependencies": {
|
|
43
|
-
"@thi.ng/api": "^8.11.
|
|
44
|
-
"@thi.ng/arrays": "^2.10.
|
|
45
|
-
"@thi.ng/checks": "^3.6.
|
|
46
|
-
"@thi.ng/compare": "^2.4.
|
|
47
|
-
"@thi.ng/compose": "^3.0.
|
|
48
|
-
"@thi.ng/errors": "^2.5.
|
|
49
|
-
"@thi.ng/math": "^5.11.
|
|
50
|
-
"@thi.ng/random": "^4.1.
|
|
47
|
+
"@thi.ng/api": "^8.11.15",
|
|
48
|
+
"@thi.ng/arrays": "^2.10.8",
|
|
49
|
+
"@thi.ng/checks": "^3.6.17",
|
|
50
|
+
"@thi.ng/compare": "^2.4.7",
|
|
51
|
+
"@thi.ng/compose": "^3.0.18",
|
|
52
|
+
"@thi.ng/errors": "^2.5.21",
|
|
53
|
+
"@thi.ng/math": "^5.11.15",
|
|
54
|
+
"@thi.ng/random": "^4.1.6",
|
|
55
|
+
"@thi.ng/timestamp": "^1.1.0"
|
|
51
56
|
},
|
|
52
57
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.48.
|
|
54
|
-
"esbuild": "^0.24.
|
|
55
|
-
"typedoc": "^0.
|
|
58
|
+
"@microsoft/api-extractor": "^7.48.1",
|
|
59
|
+
"esbuild": "^0.24.2",
|
|
60
|
+
"typedoc": "^0.27.6",
|
|
56
61
|
"typescript": "^5.7.2"
|
|
57
62
|
},
|
|
58
63
|
"keywords": [
|
|
@@ -60,6 +65,7 @@
|
|
|
60
65
|
"2d",
|
|
61
66
|
"3d",
|
|
62
67
|
"array",
|
|
68
|
+
"benchmark",
|
|
63
69
|
"clojure",
|
|
64
70
|
"composition",
|
|
65
71
|
"convolution",
|
|
@@ -599,5 +605,5 @@
|
|
|
599
605
|
],
|
|
600
606
|
"year": 2016
|
|
601
607
|
},
|
|
602
|
-
"gitHead": "
|
|
608
|
+
"gitHead": "48bf4c22bf23f88ac99f435106af2214f79a0be1\n"
|
|
603
609
|
}
|
package/partition-time.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { isIterable } from "@thi.ng/checks/is-iterable";
|
|
2
|
+
import { now, timeDiff } from "@thi.ng/timestamp";
|
|
2
3
|
import { iterator } from "./iterator.js";
|
|
3
4
|
import { partitionBy } from "./partition-by.js";
|
|
4
5
|
function partitionTime(period, src) {
|
|
5
6
|
return isIterable(src) ? iterator(partitionTime(period), src) : partitionBy(() => {
|
|
6
|
-
let
|
|
7
|
+
let prev = 0;
|
|
7
8
|
return () => {
|
|
8
|
-
const t =
|
|
9
|
-
t
|
|
10
|
-
return
|
|
9
|
+
const t = now();
|
|
10
|
+
timeDiff(prev, t) >= period && (prev = t);
|
|
11
|
+
return prev;
|
|
11
12
|
};
|
|
12
13
|
}, true);
|
|
13
14
|
}
|
package/throttle-time.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { isIterable } from "@thi.ng/checks/is-iterable";
|
|
2
|
+
import { now, timeDiff } from "@thi.ng/timestamp";
|
|
2
3
|
import { iterator1 } from "./iterator.js";
|
|
3
4
|
import { throttle } from "./throttle.js";
|
|
4
5
|
function throttleTime(delay, src) {
|
|
5
6
|
return isIterable(src) ? iterator1(throttleTime(delay), src) : throttle(() => {
|
|
6
|
-
let
|
|
7
|
+
let prev = 0;
|
|
7
8
|
return () => {
|
|
8
|
-
const t =
|
|
9
|
-
return t
|
|
9
|
+
const t = now();
|
|
10
|
+
return timeDiff(prev, t) >= delay ? (prev = t, true) : false;
|
|
10
11
|
};
|
|
11
12
|
});
|
|
12
13
|
}
|