@thi.ng/transducers 9.0.3 → 9.0.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-23T07:02:19Z
3
+ - **Last updated**: 2024-05-08T18:24:31Z
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.
package/README.md CHANGED
@@ -111,7 +111,7 @@ change for custom reducer impls.
111
111
 
112
112
  ## Related packages
113
113
 
114
- - [@thi.ng/csp](https://github.com/thi-ng/umbrella/tree/develop/packages/csp) - ES6 promise based CSP primitives & operations
114
+ - [@thi.ng/csv](https://github.com/thi-ng/umbrella/tree/develop/packages/csv) - Customizable, transducer-based CSV parser/object mapper and transformer
115
115
  - [@thi.ng/grid-iterators](https://github.com/thi-ng/umbrella/tree/develop/packages/grid-iterators) - 2D grid and shape iterators w/ multiple orderings
116
116
  - [@thi.ng/fsm](https://github.com/thi-ng/umbrella/tree/develop/packages/fsm) - Composable primitives for building declarative, transducer based Finite-State Machines & matchers for arbitrary data streams
117
117
  - [@thi.ng/rstream](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream) - Reactive streams & subscription primitives for constructing dataflow graphs / pipelines
@@ -151,7 +151,7 @@ For Node.js REPL:
151
151
  const tx = await import("@thi.ng/transducers");
152
152
  ```
153
153
 
154
- Package sizes (brotli'd, pre-treeshake): ESM: 8.89 KB
154
+ Package sizes (brotli'd, pre-treeshake): ESM: 8.88 KB
155
155
 
156
156
  ## Dependencies
157
157
 
@@ -185,6 +185,7 @@ directory are using this package:
185
185
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/ellipse-proximity.png" width="240"/> | Interactive visualization of closest points on ellipses | [Demo](https://demo.thi.ng/umbrella/ellipse-proximity/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/ellipse-proximity) |
186
186
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fft-synth.png" width="240"/> | Interactive inverse FFT toy synth | [Demo](https://demo.thi.ng/umbrella/fft-synth/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/fft-synth) |
187
187
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/fiber-basics.png" width="240"/> | Fiber-based cooperative multitasking basics | [Demo](https://demo.thi.ng/umbrella/fiber-basics/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/fiber-basics) |
188
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/geom-complex-poly.png" width="240"/> | Shape conversions & operations using polygons with holes | [Demo](https://demo.thi.ng/umbrella/geom-complex-poly/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/geom-complex-poly) |
188
189
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/grid-iterators.png" width="240"/> | Visualization of different grid iterator strategies | [Demo](https://demo.thi.ng/umbrella/grid-iterators/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/grid-iterators) |
189
190
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hdom-benchmark2.png" width="240"/> | hdom update performance benchmark w/ config options | [Demo](https://demo.thi.ng/umbrella/hdom-benchmark2/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-benchmark2) |
190
191
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/hdom-canvas-clock.png" width="240"/> | Realtime analog clock demo | [Demo](https://demo.thi.ng/umbrella/hdom-canvas-clock/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/hdom-canvas-clock) |
package/consume.js CHANGED
@@ -1,6 +1,5 @@
1
1
  const consume = (src) => {
2
- for (let _ of src)
3
- ;
2
+ for (let _ of src) ;
4
3
  };
5
4
  export {
6
5
  consume
package/cycle.js CHANGED
@@ -1,6 +1,5 @@
1
1
  function* cycle(input, num = Infinity) {
2
- if (num < 1)
3
- return;
2
+ if (num < 1) return;
4
3
  let cache = [];
5
4
  for (let i of input) {
6
5
  cache.push(i);
@@ -63,5 +63,5 @@ import type { TransformSpec } from "./api.js";
63
63
  *
64
64
  * @param spec - transformation spec
65
65
  */
66
- export declare const deepTransform: (spec: TransformSpec) => (x: any) => any;
66
+ export declare const deepTransform: (spec: TransformSpec) => ((x: any) => any);
67
67
  //# sourceMappingURL=deep-transform.d.ts.map
package/group-by-map.js CHANGED
@@ -2,8 +2,7 @@ import { __groupByOpts } from "./internal/group-opts.js";
2
2
  import { $$reduce } from "./reduce.js";
3
3
  function groupByMap(...args) {
4
4
  const res = $$reduce(groupByMap, args);
5
- if (res !== void 0)
6
- return res;
5
+ if (res !== void 0) return res;
7
6
  const opts = __groupByOpts(args[0]);
8
7
  const [init, complete, reduce] = opts.group;
9
8
  return [
package/group-by-obj.js CHANGED
@@ -2,8 +2,7 @@ import { __groupByOpts } from "./internal/group-opts.js";
2
2
  import { $$reduce } from "./reduce.js";
3
3
  function groupByObj(...args) {
4
4
  const res = $$reduce(groupByObj, args);
5
- if (res)
6
- return res;
5
+ if (res) return res;
7
6
  const opts = __groupByOpts(args[0]);
8
7
  const [_init, complete, _reduce] = opts.group;
9
8
  return [
package/moving-median.js CHANGED
@@ -5,8 +5,7 @@ import { map } from "./map.js";
5
5
  import { partition } from "./partition.js";
6
6
  function movingMedian(...args) {
7
7
  const iter = __iter(movingMedian, args);
8
- if (iter)
9
- return iter;
8
+ if (iter) return iter;
10
9
  const { key, compare } = __sortOpts(args[1]);
11
10
  const n = args[0];
12
11
  const m = n >> 1;
package/norm-count.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { $$reduce } from "./reduce.js";
2
2
  function normCount(...args) {
3
3
  const res = $$reduce(normCount, args);
4
- if (res !== void 0)
5
- return res;
4
+ if (res !== void 0) return res;
6
5
  const norm = args[0];
7
6
  return [() => 0, (acc) => acc / norm, (acc) => acc + 1];
8
7
  }
@@ -2,8 +2,7 @@ import { frequencies } from "./frequencies.js";
2
2
  import { $$reduce } from "./reduce.js";
3
3
  function normFrequenciesAuto(...args) {
4
4
  const res = $$reduce(normFrequenciesAuto, args);
5
- if (res !== void 0)
6
- return res;
5
+ if (res !== void 0) return res;
7
6
  const [init, complete, reduce] = frequencies(...args);
8
7
  let norm = 0;
9
8
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/transducers",
3
- "version": "9.0.3",
3
+ "version": "9.0.5",
4
4
  "description": "Lightweight transducer implementations for ES6 / TypeScript",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -40,20 +40,20 @@
40
40
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@thi.ng/api": "^8.11.1",
44
- "@thi.ng/arrays": "^2.9.5",
45
- "@thi.ng/checks": "^3.6.3",
46
- "@thi.ng/compare": "^2.3.4",
47
- "@thi.ng/compose": "^3.0.3",
48
- "@thi.ng/errors": "^2.5.6",
49
- "@thi.ng/math": "^5.10.12",
50
- "@thi.ng/random": "^3.7.5"
43
+ "@thi.ng/api": "^8.11.2",
44
+ "@thi.ng/arrays": "^2.9.6",
45
+ "@thi.ng/checks": "^3.6.4",
46
+ "@thi.ng/compare": "^2.3.5",
47
+ "@thi.ng/compose": "^3.0.4",
48
+ "@thi.ng/errors": "^2.5.7",
49
+ "@thi.ng/math": "^5.10.13",
50
+ "@thi.ng/random": "^3.8.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@microsoft/api-extractor": "^7.43.0",
54
- "esbuild": "^0.20.2",
55
- "typedoc": "^0.25.12",
56
- "typescript": "^5.4.3"
53
+ "@microsoft/api-extractor": "^7.43.2",
54
+ "esbuild": "^0.21.1",
55
+ "typedoc": "^0.25.13",
56
+ "typescript": "^5.4.5"
57
57
  },
58
58
  "keywords": [
59
59
  "2d",
@@ -579,7 +579,7 @@
579
579
  }
580
580
  ],
581
581
  "related": [
582
- "csp",
582
+ "csv",
583
583
  "grid-iterators",
584
584
  "fsm",
585
585
  "rstream",
@@ -589,5 +589,5 @@
589
589
  ],
590
590
  "year": 2016
591
591
  },
592
- "gitHead": "5dd66c18a3862a3af69a5b2f49563f7cbdd960c2\n"
592
+ "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
593
593
  }
package/partition-sync.js CHANGED
@@ -5,8 +5,7 @@ import { __iter, iterator } from "./iterator.js";
5
5
  import { isReduced } from "./reduced.js";
6
6
  function partitionSync(...args) {
7
7
  const iter = __iter(partitionSync, args, iterator);
8
- if (iter)
9
- return iter;
8
+ if (iter) return iter;
10
9
  const {
11
10
  key = identity,
12
11
  mergeOnly = false,
@@ -77,8 +76,7 @@ function partitionSync(...args) {
77
76
  while (requiredInputs(requiredKeys, currKeys)) {
78
77
  acc = reduce(acc, collect(cache, currKeys));
79
78
  first = false;
80
- if (isReduced(acc))
81
- break;
79
+ if (isReduced(acc)) break;
82
80
  }
83
81
  }
84
82
  return acc;
@@ -107,11 +105,9 @@ function partitionSync(...args) {
107
105
  return xform;
108
106
  }
109
107
  const requiredInputs = (required, curr) => {
110
- if (curr.size < required.size)
111
- return false;
108
+ if (curr.size < required.size) return false;
112
109
  for (let id of required) {
113
- if (!curr.has(id))
114
- return false;
110
+ if (!curr.has(id)) return false;
115
111
  }
116
112
  return true;
117
113
  };
package/rechunk.js CHANGED
@@ -2,16 +2,14 @@ import { iterator, __iter } from "./iterator.js";
2
2
  import { isReduced } from "./reduced.js";
3
3
  function rechunk(...args) {
4
4
  const iter = __iter(rechunk, args, iterator);
5
- if (iter)
6
- return iter;
5
+ if (iter) return iter;
7
6
  return ([init, complete, reduce]) => {
8
7
  let buf = "";
9
8
  const re = args[0] || /\r?\n/;
10
9
  return [
11
10
  init,
12
11
  (acc) => {
13
- if (buf)
14
- acc = reduce(acc, buf);
12
+ if (buf) acc = reduce(acc, buf);
15
13
  return complete(acc);
16
14
  },
17
15
  (acc, chunk) => {
package/sliding-window.js CHANGED
@@ -3,8 +3,7 @@ import { compR } from "./compr.js";
3
3
  import { __iter } from "./iterator.js";
4
4
  function slidingWindow(...args) {
5
5
  const iter = __iter(slidingWindow, args);
6
- if (iter)
7
- return iter;
6
+ if (iter) return iter;
8
7
  const size = args[0];
9
8
  const partial = args[1] !== false;
10
9
  return (rfn) => {
package/some.js CHANGED
@@ -2,8 +2,7 @@ import { $$reduce, reducer } from "./reduce.js";
2
2
  import { reduced } from "./reduced.js";
3
3
  function some(...args) {
4
4
  const res = $$reduce(some, args);
5
- if (res !== void 0)
6
- return res;
5
+ if (res !== void 0) return res;
7
6
  const pred = args[0];
8
7
  return reducer(
9
8
  () => false,
package/tween.js CHANGED
@@ -4,8 +4,7 @@ function* tween(opts) {
4
4
  const { min, max, num, init, mix, stops } = opts;
5
5
  const easing = opts.easing || ((x) => x);
6
6
  let l = stops.length;
7
- if (l < 1)
8
- return;
7
+ if (l < 1) return;
9
8
  if (l === 1) {
10
9
  yield* repeat(mix(init(stops[0][1], stops[0][1]), 0), num);
11
10
  }
@@ -22,8 +21,7 @@ function* tween(opts) {
22
21
  for (let t of normRange(num)) {
23
22
  t = min + range * t;
24
23
  if (t > end) {
25
- while (i < l && t > stops[i][0])
26
- i++;
24
+ while (i < l && t > stops[i][0]) i++;
27
25
  start = stops[i - 1][0];
28
26
  end = stops[i][0];
29
27
  delta = end - start;