@thi.ng/transducers 8.8.26 → 8.9.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/CHANGELOG.md +9 -1
- package/norm-range.d.ts +15 -3
- package/norm-range.js +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-02-06T23:18:11Z
|
|
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,14 @@ 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
|
+
## [8.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/transducers@8.9.0) (2024-02-06)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update normRange(), add reverse order ([c7e7fef](https://github.com/thi-ng/umbrella/commit/c7e7fef))
|
|
17
|
+
- add optional arg to reverse order of normRange()
|
|
18
|
+
- update docstrings/examples
|
|
19
|
+
|
|
12
20
|
### [8.8.9](https://github.com/thi-ng/umbrella/tree/@thi.ng/transducers@8.8.9) (2023-11-09)
|
|
13
21
|
|
|
14
22
|
#### ♻️ Refactoring
|
package/norm-range.d.ts
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Yields sequence of `n+1` monotonically increasing numbers in
|
|
3
|
-
* closed interval (0.0 .. 1.0). If `n <= 0`, yields nothing.
|
|
2
|
+
* Yields sequence of `n+1` monotonically increasing or decreasing numbers in
|
|
3
|
+
* the closed interval (0.0 .. 1.0). If `n <= 0`, yields nothing. If `reverse`
|
|
4
|
+
* is true, the values are emitted in reverse order, i.e. from 1.0 → 0.0.
|
|
4
5
|
*
|
|
5
6
|
* @example
|
|
6
7
|
* ```ts
|
|
7
8
|
* [...normRange(4)]
|
|
8
9
|
* // [0, 0.25, 0.5, 0.75, 1.0]
|
|
10
|
+
*
|
|
11
|
+
* [...normRange(4, false)]
|
|
12
|
+
* // [0, 0.25, 0.5, 0.75]
|
|
13
|
+
*
|
|
14
|
+
* [...normRange(4, true, true)]
|
|
15
|
+
* // [1, 0.75, 0.5, 0.25, 0]
|
|
16
|
+
*
|
|
17
|
+
* [...normRange(4, false, true)]
|
|
18
|
+
* // [1, 0.75, 0.5, 0.25]
|
|
9
19
|
* ```
|
|
10
20
|
*
|
|
11
21
|
* @param n - number of steps
|
|
12
22
|
* @param includeLast - include last value (i.e. `1.0`)
|
|
23
|
+
* @param reverse
|
|
13
24
|
*/
|
|
14
|
-
export declare function normRange(n: number, includeLast?: boolean): IterableIterator<number>;
|
|
25
|
+
export declare function normRange(n: number, includeLast?: boolean, reverse?: boolean): IterableIterator<number>;
|
|
15
26
|
/**
|
|
16
27
|
* 2D version of {@link normRange} in Y-major order (i.e. X is inner loop).
|
|
28
|
+
* Reverse order not supported.
|
|
17
29
|
*
|
|
18
30
|
* @param nx -
|
|
19
31
|
* @param ny -
|
package/norm-range.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { map } from "./map.js";
|
|
2
|
-
function* normRange(n, includeLast = true) {
|
|
2
|
+
function* normRange(n, includeLast = true, reverse = false) {
|
|
3
3
|
if (n > 0) {
|
|
4
4
|
for (let i = 0, m = includeLast ? n + 1 : n; i < m; i++) {
|
|
5
|
-
yield i / n;
|
|
5
|
+
yield reverse ? 1 - i / n : i / n;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/transducers",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "Lightweight transducer implementations for ES6 / TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@thi.ng/compare": "^2.2.18",
|
|
46
46
|
"@thi.ng/compose": "^2.1.61",
|
|
47
47
|
"@thi.ng/errors": "^2.4.15",
|
|
48
|
-
"@thi.ng/math": "^5.
|
|
48
|
+
"@thi.ng/math": "^5.9.0",
|
|
49
49
|
"@thi.ng/random": "^3.6.29"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
@@ -588,5 +588,5 @@
|
|
|
588
588
|
],
|
|
589
589
|
"year": 2016
|
|
590
590
|
},
|
|
591
|
-
"gitHead": "
|
|
591
|
+
"gitHead": "ce8202c237a367c4038d41919a8acf75e1122507\n"
|
|
592
592
|
}
|