@thi.ng/transducers 8.3.25 → 8.3.27
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 +1 -1
- package/README.md +9 -19
- package/api.d.ts +5 -5
- package/cat.d.ts +9 -9
- package/cat.js +9 -9
- package/choices.d.ts +4 -4
- package/choices.js +4 -4
- package/conj.d.ts +1 -1
- package/converge.d.ts +9 -9
- package/convolve.d.ts +3 -3
- package/curve.d.ts +8 -8
- package/curve.js +8 -8
- package/deep-transform.d.ts +8 -9
- package/deep-transform.js +8 -9
- package/delayed.d.ts +3 -4
- package/delayed.js +3 -4
- package/fill.d.ts +4 -5
- package/filter-fuzzy.d.ts +8 -6
- package/flatten-with.d.ts +1 -1
- package/group-binary.d.ts +13 -15
- package/group-binary.js +13 -15
- package/interpolate-hermite.d.ts +9 -9
- package/interpolate-linear.d.ts +4 -4
- package/interpolate.d.ts +12 -12
- package/labeled.d.ts +1 -1
- package/line.d.ts +6 -6
- package/line.js +6 -6
- package/map-indexed.d.ts +2 -2
- package/map-nth.d.ts +4 -5
- package/map-vals.d.ts +7 -7
- package/mapcat-indexed.d.ts +3 -3
- package/mapcat.d.ts +4 -4
- package/match-first.d.ts +1 -1
- package/moving-average.d.ts +6 -7
- package/moving-median.d.ts +4 -4
- package/multiplex-obj.d.ts +1 -1
- package/multiplex.d.ts +5 -5
- package/noop.d.ts +3 -3
- package/noop.js +3 -3
- package/package.json +19 -15
- package/page.d.ts +4 -5
- package/pairs.d.ts +3 -3
- package/pairs.js +3 -3
- package/partition-sort.d.ts +2 -2
- package/partition-time.d.ts +6 -7
- package/peek.d.ts +3 -2
- package/push-sort.d.ts +3 -3
- package/range.d.ts +3 -3
- package/range.js +3 -3
- package/sample.d.ts +1 -1
- package/scan.d.ts +1 -1
- package/select-keys.d.ts +4 -4
- package/some.d.ts +3 -3
- package/sorted-keys.d.ts +4 -3
- package/sorted-keys.js +4 -3
- package/stream-sort.d.ts +3 -3
- package/swizzle.d.ts +5 -4
- package/throttle-time.d.ts +5 -6
- package/throttle.d.ts +9 -9
- package/tween.d.ts +24 -26
- package/tween.js +24 -26
package/interpolate.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import type { Fn2 } from "@thi.ng/api";
|
|
2
2
|
import type { Transducer } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Higher order interpolation transducer. The resulting transducer forms
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Higher order interpolation transducer. The resulting transducer forms a
|
|
5
|
+
* sliding window and calls `fn` (the given interpolation function) `n` times
|
|
6
|
+
* with the current window and a normalized time value to produce the requested
|
|
7
|
+
* number of interpolated values per interval.
|
|
8
8
|
*
|
|
9
9
|
* @remarks
|
|
10
|
-
* If the optional `src` iterable is given, `interpolate` returns an
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* If the optional `src` iterable is given, `interpolate` returns an iterator of
|
|
11
|
+
* interpolated values. No values will be produced if the number of inputs is
|
|
12
|
+
* less than given `window` size.
|
|
13
13
|
*
|
|
14
|
-
* Note: The *very last* input value can never be fully reached and
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Note: The *very last* input value can never be fully reached and might need
|
|
15
|
+
* to be explicitly duplicated in the input, e.g. via the {@link extendSides}
|
|
16
|
+
* iterator...
|
|
17
17
|
*
|
|
18
18
|
* See also:
|
|
19
|
-
* - {@link
|
|
20
|
-
* - {@link
|
|
19
|
+
* - {@link interpolateHermite}
|
|
20
|
+
* - {@link interpolateLinear}
|
|
21
21
|
* - {@link extendSides}
|
|
22
22
|
*
|
|
23
23
|
* @example
|
package/labeled.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
|
-
export
|
|
2
|
+
export type LabelFn<L, T> = L | ((x: T) => L);
|
|
3
3
|
export declare function labeled<L, T>(id: LabelFn<L, T>): Transducer<T, [L, T]>;
|
|
4
4
|
export declare function labeled<L, T>(id: LabelFn<L, T>, src: Iterable<T>): IterableIterator<[L, T]>;
|
|
5
5
|
//# sourceMappingURL=labeled.d.ts.map
|
package/line.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Iterator yielding `steps` + 1 interpolated values on a line in the
|
|
3
|
-
*
|
|
2
|
+
* Iterator yielding `steps` + 1 interpolated values on a line in the closed
|
|
3
|
+
* `[start .. end]` interval.
|
|
4
4
|
*
|
|
5
5
|
* @remarks
|
|
6
|
-
* This is similar to {@link range}, but potentially provides more
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* This is similar to {@link range}, but potentially provides more precise
|
|
7
|
+
* values (by avoiding the accumulation of floating point errors during
|
|
8
|
+
* iteration).
|
|
9
9
|
*
|
|
10
10
|
* Similar functionality (w/ more options) is availble here:
|
|
11
|
-
*
|
|
11
|
+
* [`line()`](https://docs.thi.ng/umbrella/dsp/functions/line.html).
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
package/line.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { map } from "./map.js";
|
|
2
2
|
import { normRange } from "./norm-range.js";
|
|
3
3
|
/**
|
|
4
|
-
* Iterator yielding `steps` + 1 interpolated values on a line in the
|
|
5
|
-
*
|
|
4
|
+
* Iterator yielding `steps` + 1 interpolated values on a line in the closed
|
|
5
|
+
* `[start .. end]` interval.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* This is similar to {@link range}, but potentially provides more
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* This is similar to {@link range}, but potentially provides more precise
|
|
9
|
+
* values (by avoiding the accumulation of floating point errors during
|
|
10
|
+
* iteration).
|
|
11
11
|
*
|
|
12
12
|
* Similar functionality (w/ more options) is availble here:
|
|
13
|
-
*
|
|
13
|
+
* [`line()`](https://docs.thi.ng/umbrella/dsp/functions/line.html).
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
package/map-indexed.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Fn2 } from "@thi.ng/api";
|
|
2
2
|
import type { Transducer } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Transducer. Similar to {@link
|
|
5
|
-
*
|
|
4
|
+
* Transducer. Similar to {@link map}, but given `fn` takes two arguments:
|
|
5
|
+
* `index` and `value` to transform.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
8
|
* An optional start index `offset` can be provided (default 0).
|
package/map-nth.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { Fn } from "@thi.ng/api";
|
|
2
2
|
import type { Transducer } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Transducer. Similar to {@link
|
|
5
|
-
*
|
|
6
|
-
* downstream.
|
|
4
|
+
* Transducer. Similar to {@link map}, but only transforms every `n`-th input
|
|
5
|
+
* value and passes intermediate values unchanged downstream.
|
|
7
6
|
*
|
|
8
7
|
* @remarks
|
|
9
|
-
* The optional `offset` arg can be used to adjust the
|
|
10
|
-
*
|
|
8
|
+
* The optional `offset` arg can be used to adjust the number of inputs before
|
|
9
|
+
* the first transformation occurs (default 0).
|
|
11
10
|
*
|
|
12
11
|
* @example
|
|
13
12
|
* ```ts
|
package/map-vals.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Fn, IObjectOf } from "@thi.ng/api";
|
|
2
2
|
import type { Transducer } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Transducer. Similar to {@link
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Transducer. Similar to {@link map}, but expects object values and the given
|
|
5
|
+
* function `fn` is applied to each enumerable property value and the results
|
|
6
|
+
* reassigned to their original keys.
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
* By default, a shallow copy of the source object is created. The
|
|
10
|
-
*
|
|
9
|
+
* By default, a shallow copy of the source object is created. The resulting
|
|
10
|
+
* object is then used as the result of this transducer.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
@@ -16,8 +16,8 @@ import type { Transducer } from "./api.js";
|
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
18
|
* @param fn -
|
|
19
|
-
* @param copy - if true (default), creates a shallow copy of each
|
|
20
|
-
*
|
|
19
|
+
* @param copy - if true (default), creates a shallow copy of each incoming
|
|
20
|
+
* value
|
|
21
21
|
*/
|
|
22
22
|
export declare function mapVals<A, B>(fn: Fn<A, B>, copy?: boolean): Transducer<IObjectOf<A>, IObjectOf<B>>;
|
|
23
23
|
export declare function mapVals<A, B>(fn: Fn<A, B>, src: Iterable<IObjectOf<A>>): IterableIterator<IObjectOf<B>>;
|
package/mapcat-indexed.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Fn2 } from "@thi.ng/api";
|
|
2
2
|
import type { Transducer } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Transducer. Similar to {@link
|
|
5
|
-
*
|
|
4
|
+
* Transducer. Similar to {@link mapcat}, but given `fn` takes two arguments:
|
|
5
|
+
* `index` and `value` to transform.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
8
|
* An optional start index `offset` can be provided (default 0). Also see
|
|
9
|
-
* {@link
|
|
9
|
+
* {@link mapIndexed}.
|
|
10
10
|
*
|
|
11
11
|
* @param fn - transformation function
|
|
12
12
|
* @param offset - initial index
|
package/mapcat.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Fn } from "@thi.ng/api";
|
|
2
2
|
import type { Transducer } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Transducer. Similar to {@link
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Transducer. Similar to {@link map}, but expects the given mapping function
|
|
5
|
+
* `fn` to return an iterable result (or `null`) and then emits each value of
|
|
6
|
+
* the result individually downstream. `null` or `undefined` result values will
|
|
7
|
+
* be skipped / omitted.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```
|
package/match-first.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { Transducer } from "./api.js";
|
|
|
10
10
|
*
|
|
11
11
|
* Yields none or only the first value which passed the predicate check
|
|
12
12
|
* and then causes early termination. If `src` input is given, returns
|
|
13
|
-
* first match found (or `undefined`). Also see {@link
|
|
13
|
+
* first match found (or `undefined`). Also see {@link matchLast}.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
package/moving-average.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Computes the
|
|
4
|
-
*
|
|
3
|
+
* Computes the [Simple Moving
|
|
4
|
+
* Average](https://en.wikipedia.org/wiki/Moving_average#Simple_moving_average)
|
|
5
5
|
* of given period.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* The number of results will be `period-1` less than the number of
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* The number of results will be `period-1` less than the number of processed
|
|
9
|
+
* inputs and no outputs will be produced if there were less than `period` input
|
|
10
|
+
* values.
|
|
11
11
|
*
|
|
12
|
-
* Also see the
|
|
13
|
-
* {@link @thi.ng/transducers-stats# | @thi.ng/transducers-stats}
|
|
12
|
+
* Also see the [thi.ng/transducers-stats](https://thi.ng/transducers-stats)
|
|
14
13
|
* package for more optimized and alternative MA strategies.
|
|
15
14
|
*
|
|
16
15
|
* @param period -
|
package/moving-median.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SortOpts, Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Transducer. Similar to {@link
|
|
4
|
-
*
|
|
3
|
+
* Transducer. Similar to {@link movingAverage}, but yields median of sliding
|
|
4
|
+
* window and supports non-numeric inputs.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
|
-
* The optional `key` and `cmp` function options can be used to select /
|
|
8
|
-
*
|
|
7
|
+
* The optional `key` and `cmp` function options can be used to select / compute
|
|
8
|
+
* a sortable value and change sorting behavior.
|
|
9
9
|
*
|
|
10
10
|
* @param n - window size
|
|
11
11
|
* @param opts -
|
package/multiplex-obj.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
2
|
import type { Reducer, Transducer, TxLike } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Transducer. Similar to (and building on) {@link
|
|
4
|
+
* Transducer. Similar to (and building on) {@link multiplex}, but takes an
|
|
5
5
|
* object of transducers and produces a result object for each input.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
package/multiplex.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Transducer, TxLike } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Yields a new transducer which applies given transducers in parallel
|
|
4
|
-
* (
|
|
5
|
-
* tuples of results.
|
|
3
|
+
* Yields a new transducer which applies given transducers in parallel (using
|
|
4
|
+
* [`juxt()`](https://docs.thi.ng/umbrella/compose/functions/juxt.html) &
|
|
5
|
+
* {@link step}) and produces tuples of results.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* Use the {@link noop} transducer for processing lanes which should
|
|
9
|
-
*
|
|
8
|
+
* Use the {@link noop} transducer for processing lanes which should retain the
|
|
9
|
+
* original input values.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
package/noop.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* No-op / pass-through transducer, essentially the same as:
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* No-op / pass-through transducer, essentially the same as: `map((x) => x)`,
|
|
4
|
+
* but faster. Useful for testing and / or to keep existing values in a
|
|
5
|
+
* {@link multiplex} tuple lane.
|
|
6
6
|
*/
|
|
7
7
|
export declare const noop: <T>() => Transducer<T, T>;
|
|
8
8
|
//# sourceMappingURL=noop.d.ts.map
|
package/noop.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* No-op / pass-through transducer, essentially the same as:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* No-op / pass-through transducer, essentially the same as: `map((x) => x)`,
|
|
3
|
+
* but faster. Useful for testing and / or to keep existing values in a
|
|
4
|
+
* {@link multiplex} tuple lane.
|
|
5
5
|
*/
|
|
6
6
|
export const noop = () => (rfn) => rfn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/transducers",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.27",
|
|
4
4
|
"description": "Lightweight transducer implementations for ES6 / TypeScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
|
+
"contributors": [
|
|
26
|
+
"Gavin Cannizzaro (https://github.com/gavinpc-mindgrub)",
|
|
27
|
+
"@nkint (https://github.com/nkint)"
|
|
28
|
+
],
|
|
25
29
|
"license": "Apache-2.0",
|
|
26
30
|
"scripts": {
|
|
27
31
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,22 +38,22 @@
|
|
|
34
38
|
"test": "testament test"
|
|
35
39
|
},
|
|
36
40
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/arrays": "^2.4.
|
|
39
|
-
"@thi.ng/checks": "^3.3.
|
|
40
|
-
"@thi.ng/compare": "^2.1.
|
|
41
|
-
"@thi.ng/compose": "^2.1.
|
|
42
|
-
"@thi.ng/errors": "^2.2.
|
|
43
|
-
"@thi.ng/math": "^5.3.
|
|
44
|
-
"@thi.ng/random": "^3.3.
|
|
41
|
+
"@thi.ng/api": "^8.6.1",
|
|
42
|
+
"@thi.ng/arrays": "^2.4.6",
|
|
43
|
+
"@thi.ng/checks": "^3.3.5",
|
|
44
|
+
"@thi.ng/compare": "^2.1.20",
|
|
45
|
+
"@thi.ng/compose": "^2.1.22",
|
|
46
|
+
"@thi.ng/errors": "^2.2.6",
|
|
47
|
+
"@thi.ng/math": "^5.3.17",
|
|
48
|
+
"@thi.ng/random": "^3.3.19"
|
|
45
49
|
},
|
|
46
50
|
"devDependencies": {
|
|
47
|
-
"@microsoft/api-extractor": "^7.33.
|
|
48
|
-
"@thi.ng/testament": "^0.3.
|
|
51
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
52
|
+
"@thi.ng/testament": "^0.3.7",
|
|
49
53
|
"rimraf": "^3.0.2",
|
|
50
54
|
"tools": "^0.0.1",
|
|
51
|
-
"typedoc": "^0.23.
|
|
52
|
-
"typescript": "^4.
|
|
55
|
+
"typedoc": "^0.23.22",
|
|
56
|
+
"typescript": "^4.9.4"
|
|
53
57
|
},
|
|
54
58
|
"keywords": [
|
|
55
59
|
"2d",
|
|
@@ -567,5 +571,5 @@
|
|
|
567
571
|
],
|
|
568
572
|
"year": 2016
|
|
569
573
|
},
|
|
570
|
-
"gitHead": "
|
|
574
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
571
575
|
}
|
package/page.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Pagination helper. Returns transducer which extracts only items for
|
|
4
|
-
*
|
|
3
|
+
* Pagination helper. Returns transducer which extracts only items for given
|
|
4
|
+
* page number (and page length, default 10).
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
|
-
* When {@link
|
|
8
|
-
*
|
|
9
|
-
* processing steps.
|
|
7
|
+
* When {@link comp}osing with other transducers, it's most efficient if `page`
|
|
8
|
+
* is used as early as possible / prior to any heavy processing steps.
|
|
10
9
|
*
|
|
11
10
|
* @example
|
|
12
11
|
* ```ts
|
package/pairs.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IObjectOf } from "@thi.ng/api";
|
|
2
2
|
/**
|
|
3
|
-
* Iterator yielding key-value pairs of given object's own properties
|
|
4
|
-
*
|
|
3
|
+
* Iterator yielding key-value pairs of given object's own properties and their
|
|
4
|
+
* values. Same as `zip(keys(x), vals(x))`.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
7
|
* - {@link vals}
|
|
8
|
-
* - {@link
|
|
8
|
+
* - {@link zip}
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
package/pairs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Iterator yielding key-value pairs of given object's own properties
|
|
3
|
-
*
|
|
2
|
+
* Iterator yielding key-value pairs of given object's own properties and their
|
|
3
|
+
* values. Same as `zip(keys(x), vals(x))`.
|
|
4
4
|
*
|
|
5
5
|
* @remarks
|
|
6
6
|
* - {@link vals}
|
|
7
|
-
* - {@link
|
|
7
|
+
* - {@link zip}
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
package/partition-sort.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SortOpts, Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Transducer. Composition of {@link
|
|
4
|
-
* {@link
|
|
3
|
+
* Transducer. Composition of {@link partition} and
|
|
4
|
+
* {@link mapcat} which yields a **partially** sorted sequence of
|
|
5
5
|
* input values. Sorting is performed on sliding / non-overlapping
|
|
6
6
|
* chunks of `n` inputs.
|
|
7
7
|
*
|
package/partition-time.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Transducer. Yields tumbling, non-overlapping windows/partitions of
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Transducer. Yields tumbling, non-overlapping windows/partitions of input
|
|
4
|
+
* values, with the window size defined by given realtime `period` (in
|
|
5
|
+
* milliseconds).
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* Only to be used in async contexts, NOT with {@link
|
|
9
|
-
* directly.
|
|
8
|
+
* Only to be used in async contexts, NOT with {@link transduce} directly.
|
|
10
9
|
*
|
|
11
10
|
* Also see:
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
11
|
+
* - [`thi.ng/rstream`](https://thi.ng/rstream)
|
|
12
|
+
* - [`thi.ng/csp`](https://thi.ng/csp).
|
|
14
13
|
*
|
|
15
14
|
* @example
|
|
16
15
|
* ```ts
|
package/peek.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Transducer version of
|
|
4
|
-
*
|
|
3
|
+
* Transducer version of
|
|
4
|
+
* [`peek()`](https://docs.thi.ng/umbrella/api/functions/peek.html), i.e.
|
|
5
|
+
* extracts the last item of an array.
|
|
5
6
|
*
|
|
6
7
|
* @example
|
|
7
8
|
* ```ts
|
package/push-sort.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Comparator } from "@thi.ng/api";
|
|
2
2
|
import type { Reducer } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Similar to {@link
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Similar to {@link push}, but sorts result array upon completion using
|
|
5
|
+
* optionally given comparator (default
|
|
6
|
+
* [`compare()`](https://docs.thi.ng/umbrella/compare/functions/compare.html)).
|
|
7
7
|
*
|
|
8
8
|
* @param cmp -
|
|
9
9
|
*/
|
package/range.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export declare function range(to: number): Range;
|
|
|
5
5
|
export declare function range(from: number, to: number): Range;
|
|
6
6
|
export declare function range(from: number, to: number, step: number): Range;
|
|
7
7
|
/**
|
|
8
|
-
* Simple class wrapper around given range interval and implementing
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Simple class wrapper around given range interval and implementing `Iterable`
|
|
9
|
+
* and {@link IReducible} interfaces, the latter is used to accelerate use with
|
|
10
|
+
* {@link reduce}.
|
|
11
11
|
*/
|
|
12
12
|
export declare class Range implements Iterable<number>, IReducible<any, number> {
|
|
13
13
|
protected from: number;
|
package/range.js
CHANGED
|
@@ -3,9 +3,9 @@ export function range(from, to, step) {
|
|
|
3
3
|
return new Range(from, to, step);
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* Simple class wrapper around given range interval and implementing
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Simple class wrapper around given range interval and implementing `Iterable`
|
|
7
|
+
* and {@link IReducible} interfaces, the latter is used to accelerate use with
|
|
8
|
+
* {@link reduce}.
|
|
9
9
|
*/
|
|
10
10
|
export class Range {
|
|
11
11
|
constructor(from, to, step) {
|
package/sample.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Transducer } from "./api.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Transducer which only yields values with given `prob` probability
|
|
5
5
|
* (0.0 .. 1.0 range). Supports custom PRNGs via
|
|
6
|
-
*
|
|
6
|
+
* [`IRandom`](https://docs.thi.ng/umbrella/random/interfaces/IRandom.html) interface.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
package/scan.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { Reducer, Transducer } from "./api.js";
|
|
|
8
8
|
* default.
|
|
9
9
|
*
|
|
10
10
|
* @remarks
|
|
11
|
-
*
|
|
11
|
+
* https://en.wikipedia.org/wiki/Prefix_sum#Scan_higher_order_function
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts
|
package/select-keys.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Transducer which yields sequence of transformed objects, each only
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Transducer which yields sequence of transformed objects, each only only
|
|
4
|
+
* containing the given `keys`. If a key's value is `undefined` (or missing
|
|
5
|
+
* entirely) it will be omitted in the result.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* For single key extraction {@link
|
|
8
|
+
* For single key extraction {@link pluck} is a faster alternative.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
package/some.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Predicate } from "@thi.ng/api";
|
|
2
2
|
import type { Reducer } from "./api.js";
|
|
3
3
|
/**
|
|
4
|
-
* Similar to {@link
|
|
5
|
-
* succeed predicate test (and then immediately terminates with `true`
|
|
6
|
-
*
|
|
4
|
+
* Similar to {@link every} reducer, but only requires at least 1 value to
|
|
5
|
+
* succeed predicate test (and then immediately terminates with `true` as
|
|
6
|
+
* result).
|
|
7
7
|
*
|
|
8
8
|
* @param pred -
|
|
9
9
|
*/
|
package/sorted-keys.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Comparator } from "@thi.ng/api";
|
|
2
2
|
/**
|
|
3
|
-
* Syntax sugar for `Object.keys(x).sort()` with support for custom
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Syntax sugar for `Object.keys(x).sort()` with support for custom comparator
|
|
4
|
+
* (default:
|
|
5
|
+
* [`compare()`](https://docs.thi.ng/umbrella/compare/functions/compare.html))
|
|
6
|
+
* and yielding iterator of sorted keys.
|
|
6
7
|
*
|
|
7
8
|
* @param x -
|
|
8
9
|
* @param cmp -
|
package/sorted-keys.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { compare } from "@thi.ng/compare/compare";
|
|
2
2
|
/**
|
|
3
|
-
* Syntax sugar for `Object.keys(x).sort()` with support for custom
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Syntax sugar for `Object.keys(x).sort()` with support for custom comparator
|
|
4
|
+
* (default:
|
|
5
|
+
* [`compare()`](https://docs.thi.ng/umbrella/compare/functions/compare.html))
|
|
6
|
+
* and yielding iterator of sorted keys.
|
|
6
7
|
*
|
|
7
8
|
* @param x -
|
|
8
9
|
* @param cmp -
|
package/stream-sort.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SortOpts, Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Transducer. Similar to {@link
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Transducer. Similar to {@link partitionSort}, however uses proper sliding
|
|
4
|
+
* window and insertion sort instead of fully sorting window as done by
|
|
5
|
+
* `partitionSort`.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```ts
|
package/swizzle.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Transducer which performs value reordering on inputs using provided
|
|
4
|
-
*
|
|
5
|
-
* arrays.
|
|
3
|
+
* Transducer which performs value reordering on inputs using provided property
|
|
4
|
+
* order. Accepts arrays or objects as input, but always yields arrays.
|
|
6
5
|
*
|
|
7
6
|
* @example
|
|
8
7
|
* ```ts
|
|
@@ -16,7 +15,9 @@ import type { Transducer } from "./api.js";
|
|
|
16
15
|
* // [ [ 3, 1 ] ]
|
|
17
16
|
* ```
|
|
18
17
|
*
|
|
19
|
-
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Also see
|
|
20
|
+
* [`swizzle()`](https://docs.thi.ng/umbrella/arrays/functions/swizzle.html)
|
|
20
21
|
*
|
|
21
22
|
* @param order - key order
|
|
22
23
|
*/
|
package/throttle-time.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { Transducer } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Time-based version of {@link
|
|
4
|
-
*
|
|
3
|
+
* Time-based version of {@link throttle}. Ignores any new values in the `delay`
|
|
4
|
+
* interval since the last accepted value.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
|
-
* Only to be used in async contexts and NOT with {@link
|
|
8
|
-
* directly.
|
|
7
|
+
* Only to be used in async contexts and NOT with {@link transduce} directly.
|
|
9
8
|
*
|
|
10
9
|
* Also see:
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
10
|
+
* - [`thi.ng/rstream`](https://thi.ng/rstream)
|
|
11
|
+
* - [`thi.ng/csp`](https://thi.ng/csp).
|
|
13
12
|
*
|
|
14
13
|
* @param delay -
|
|
15
14
|
*/
|