diff --git a/packages/associative/CHANGELOG.md b/packages/associative/CHANGELOG.md index 27879e058d..ea8b98ee6d 100644 --- a/packages/associative/CHANGELOG.md +++ b/packages/associative/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@0.5.8...@thi.ng/associative@0.5.9) (2018-07-03) + + +### Bug Fixes + +* **associative:** minor SortedSet fixes ([33f0d19](https://github.com/thi-ng/umbrella/commit/33f0d19)) + + + + ## [0.5.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@0.5.7...@thi.ng/associative@0.5.8) (2018-06-21) diff --git a/packages/associative/package.json b/packages/associative/package.json index aeb5d6ecdb..2902bc1e25 100644 --- a/packages/associative/package.json +++ b/packages/associative/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/associative", - "version": "0.5.8", + "version": "0.5.9", "description": "Alternative Set & Map data type implementations with customizable equality semantics & supporting operations", "main": "./index.js", "typings": "./index.d.ts", diff --git a/packages/associative/src/sorted-set.ts b/packages/associative/src/sorted-set.ts index 64144c1be5..041f9cdf44 100644 --- a/packages/associative/src/sorted-set.ts +++ b/packages/associative/src/sorted-set.ts @@ -34,7 +34,7 @@ export class SortedSet extends Set implements * @param values * @param opts */ - constructor(values?: Iterable, opts?: SortedSetOpts) { + constructor(values?: Iterable, opts?: Partial>) { super(); __private.set(this, new SortedMap( values ? map((x) => [x, x], values) : null, @@ -124,7 +124,7 @@ export class SortedSet extends Set implements __private.get(this).clear(); } - first() { + first(): T { const first = __private.get(this).first(); return first ? first[0] : undefined; } diff --git a/packages/csp/CHANGELOG.md b/packages/csp/CHANGELOG.md index 460d8e1287..2ec464b1ae 100644 --- a/packages/csp/CHANGELOG.md +++ b/packages/csp/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.3.46](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@0.3.45...@thi.ng/csp@0.3.46) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/csp + ## [0.3.45](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@0.3.44...@thi.ng/csp@0.3.45) (2018-06-21) diff --git a/packages/csp/package.json b/packages/csp/package.json index 36e0c11d82..4ec4ebe90f 100644 --- a/packages/csp/package.json +++ b/packages/csp/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/csp", - "version": "0.3.45", + "version": "0.3.46", "description": "ES6 promise based CSP implementation", "main": "./index.js", "typings": "./index.d.ts", @@ -36,7 +36,7 @@ "@thi.ng/checks": "^1.5.5", "@thi.ng/dcons": "^1.0.5", "@thi.ng/errors": "^0.1.4", - "@thi.ng/transducers": "^1.11.1" + "@thi.ng/transducers": "^1.12.0" }, "keywords": [ "async", diff --git a/packages/dgraph/CHANGELOG.md b/packages/dgraph/CHANGELOG.md index b189365a50..72d8798938 100644 --- a/packages/dgraph/CHANGELOG.md +++ b/packages/dgraph/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.2.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@0.2.8...@thi.ng/dgraph@0.2.9) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/dgraph + ## [0.2.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@0.2.7...@thi.ng/dgraph@0.2.8) (2018-06-21) diff --git a/packages/dgraph/package.json b/packages/dgraph/package.json index 2512297c86..98a67ace89 100644 --- a/packages/dgraph/package.json +++ b/packages/dgraph/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dgraph", - "version": "0.2.8", + "version": "0.2.9", "description": "Type-agnostic directed acyclic graph (DAG) & graph operations", "main": "./index.js", "typings": "./index.d.ts", @@ -29,7 +29,7 @@ }, "dependencies": { "@thi.ng/api": "^4.0.4", - "@thi.ng/associative": "^0.5.8", + "@thi.ng/associative": "^0.5.9", "@thi.ng/equiv": "^0.1.5", "@thi.ng/errors": "^0.1.4", "@thi.ng/iterators": "^4.1.18" diff --git a/packages/hiccup-css/CHANGELOG.md b/packages/hiccup-css/CHANGELOG.md index db432a47f9..b7f98b5d50 100644 --- a/packages/hiccup-css/CHANGELOG.md +++ b/packages/hiccup-css/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.2.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-css@0.2.3...@thi.ng/hiccup-css@0.2.4) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/hiccup-css + ## [0.2.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-css@0.2.2...@thi.ng/hiccup-css@0.2.3) (2018-06-21) diff --git a/packages/hiccup-css/package.json b/packages/hiccup-css/package.json index f2d4aa488e..26217ba95e 100644 --- a/packages/hiccup-css/package.json +++ b/packages/hiccup-css/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hiccup-css", - "version": "0.2.3", + "version": "0.2.4", "description": "CSS from nested JS data structures", "main": "./index.js", "typings": "./index.d.ts", @@ -31,7 +31,7 @@ "@thi.ng/api": "^4.0.4", "@thi.ng/checks": "^1.5.5", "@thi.ng/errors": "^0.1.4", - "@thi.ng/transducers": "^1.11.1" + "@thi.ng/transducers": "^1.12.0" }, "keywords": [ "clojure", diff --git a/packages/rstream-csp/CHANGELOG.md b/packages/rstream-csp/CHANGELOG.md index b9c95246e3..8ebe2b9fe6 100644 --- a/packages/rstream-csp/CHANGELOG.md +++ b/packages/rstream-csp/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.1.80](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.79...@thi.ng/rstream-csp@0.1.80) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + + +## [0.1.79](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.78...@thi.ng/rstream-csp@0.1.79) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + ## [0.1.78](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.77...@thi.ng/rstream-csp@0.1.78) (2018-06-21) diff --git a/packages/rstream-csp/package.json b/packages/rstream-csp/package.json index b1e6bbc0b1..44b453fd64 100644 --- a/packages/rstream-csp/package.json +++ b/packages/rstream-csp/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-csp", - "version": "0.1.78", + "version": "0.1.80", "description": "@thi.ng/csp bridge module for @thi.ng/rstream", "main": "./index.js", "typings": "./index.d.ts", @@ -28,8 +28,8 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/csp": "^0.3.45", - "@thi.ng/rstream": "^1.8.0" + "@thi.ng/csp": "^0.3.46", + "@thi.ng/rstream": "^1.8.2" }, "keywords": [ "bridge", diff --git a/packages/rstream-dot/CHANGELOG.md b/packages/rstream-dot/CHANGELOG.md index 280414f472..c2247b236f 100644 --- a/packages/rstream-dot/CHANGELOG.md +++ b/packages/rstream-dot/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.2.19](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-dot@0.2.18...@thi.ng/rstream-dot@0.2.19) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-dot + + +## [0.2.18](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-dot@0.2.17...@thi.ng/rstream-dot@0.2.18) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-dot + ## [0.2.17](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-dot@0.2.16...@thi.ng/rstream-dot@0.2.17) (2018-06-21) diff --git a/packages/rstream-dot/package.json b/packages/rstream-dot/package.json index 6f97d99720..85bc750f5d 100644 --- a/packages/rstream-dot/package.json +++ b/packages/rstream-dot/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-dot", - "version": "0.2.17", + "version": "0.2.19", "description": "Graphviz DOT conversion of @thi.ng/rstream dataflow graph topologies", "main": "./index.js", "typings": "./index.d.ts", @@ -28,7 +28,7 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/rstream": "^1.8.0" + "@thi.ng/rstream": "^1.8.2" }, "keywords": [ "conversion", diff --git a/packages/rstream-gestures/CHANGELOG.md b/packages/rstream-gestures/CHANGELOG.md index e7e2db6ff8..94969a4d93 100644 --- a/packages/rstream-gestures/CHANGELOG.md +++ b/packages/rstream-gestures/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.3.16](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-gestures@0.3.15...@thi.ng/rstream-gestures@0.3.16) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-gestures + + +## [0.3.15](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-gestures@0.3.14...@thi.ng/rstream-gestures@0.3.15) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-gestures + ## [0.3.14](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-gestures@0.3.13...@thi.ng/rstream-gestures@0.3.14) (2018-06-21) diff --git a/packages/rstream-gestures/package.json b/packages/rstream-gestures/package.json index 734843895d..e250727c1d 100644 --- a/packages/rstream-gestures/package.json +++ b/packages/rstream-gestures/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-gestures", - "version": "0.3.14", + "version": "0.3.16", "description": "Unified mouse, mouse wheel & single-touch event stream abstraction", "main": "./index.js", "typings": "./index.d.ts", @@ -29,8 +29,8 @@ }, "dependencies": { "@thi.ng/api": "^4.0.4", - "@thi.ng/rstream": "^1.8.0", - "@thi.ng/transducers": "^1.11.1" + "@thi.ng/rstream": "^1.8.2", + "@thi.ng/transducers": "^1.12.0" }, "keywords": [ "dataflow", diff --git a/packages/rstream-graph/CHANGELOG.md b/packages/rstream-graph/CHANGELOG.md index 28006105c3..1ac0f1392e 100644 --- a/packages/rstream-graph/CHANGELOG.md +++ b/packages/rstream-graph/CHANGELOG.md @@ -3,6 +3,33 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [2.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@2.1.2...@thi.ng/rstream-graph@2.1.3) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-graph + + +## [2.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@2.1.1...@thi.ng/rstream-graph@2.1.2) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-graph + + +## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@2.1.0...@thi.ng/rstream-graph@2.1.1) (2018-06-25) + + +### Bug Fixes + +* **rstream-graph:** individual node outputs ([c4fad70](https://github.com/thi-ng/umbrella/commit/c4fad70)) + + + + # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@2.0.3...@thi.ng/rstream-graph@2.1.0) (2018-06-21) diff --git a/packages/rstream-graph/package.json b/packages/rstream-graph/package.json index db7129c991..37851e6813 100644 --- a/packages/rstream-graph/package.json +++ b/packages/rstream-graph/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-graph", - "version": "2.1.0", + "version": "2.1.3", "description": "Declarative dataflow graph construction for @thi.ng/rstream", "main": "./index.js", "typings": "./index.d.ts", @@ -33,8 +33,8 @@ "@thi.ng/errors": "^0.1.4", "@thi.ng/paths": "^1.3.10", "@thi.ng/resolve-map": "^3.0.2", - "@thi.ng/rstream": "^1.8.0", - "@thi.ng/transducers": "^1.11.1" + "@thi.ng/rstream": "^1.8.2", + "@thi.ng/transducers": "^1.12.0" }, "keywords": [ "compute", diff --git a/packages/rstream-graph/src/graph.ts b/packages/rstream-graph/src/graph.ts index c263043a02..b3204fc797 100644 --- a/packages/rstream-graph/src/graph.ts +++ b/packages/rstream-graph/src/graph.ts @@ -11,6 +11,7 @@ import { fromIterableSync } from "@thi.ng/rstream/from/iterable"; import { fromView } from "@thi.ng/rstream/from/view"; import { StreamSync, sync } from "@thi.ng/rstream/stream-sync"; import { Transducer } from "@thi.ng/transducers/api"; +import { map } from "@thi.ng/transducers/xform/map"; import { Graph, @@ -141,9 +142,13 @@ const prepareNodeOutputs = (outs: IObjectOf, node: ISubscribable next: (x) => state.resetIn(path, x) }, `out-${nodeID}`))(o); } else { - res[id] = ((path, id) => node.subscribe({ - next: (x) => state.resetIn(path, x[id]) - }, `out-${nodeID}-${id}`))(o, id); + res[id] = ((path, id) => node.subscribe( + { + next: (x) => state.resetIn(path, x) + }, + map((x) => x != null ? x[id] : x), + `out-${nodeID}-${id}`) + )(o, id); } } return res; diff --git a/packages/rstream-graph/test/index.ts b/packages/rstream-graph/test/index.ts index 461a548328..ab6d50717f 100644 --- a/packages/rstream-graph/test/index.ts +++ b/packages/rstream-graph/test/index.ts @@ -63,13 +63,13 @@ describe("rstream-graph", () => { graph.mul.node.subscribe({ next: (x) => acc.push(x) }); setTimeout(() => { state.resetIn("a", 10); - console.log(graph); + // console.log(graph); assert.deepEqual(acc, [600, 1200, 1800, 7200]); assert.deepEqual( state.deref(), { a: 10, b: 2, foo: { baz: 7200 }, res: { x: 7200, x2: 14400 }, res2: { x: 7200 } } ); done(); - }, 10); + }, 30); }); }); diff --git a/packages/rstream-log/CHANGELOG.md b/packages/rstream-log/CHANGELOG.md index 1323c200db..4690d66be6 100644 --- a/packages/rstream-log/CHANGELOG.md +++ b/packages/rstream-log/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [1.0.31](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@1.0.30...@thi.ng/rstream-log@1.0.31) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-log + + +## [1.0.30](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@1.0.29...@thi.ng/rstream-log@1.0.30) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-log + ## [1.0.29](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@1.0.28...@thi.ng/rstream-log@1.0.29) (2018-06-21) diff --git a/packages/rstream-log/package.json b/packages/rstream-log/package.json index 9bb9fd48a1..6f14260e26 100644 --- a/packages/rstream-log/package.json +++ b/packages/rstream-log/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-log", - "version": "1.0.29", + "version": "1.0.31", "description": "Structured, multilevel & hierarchical loggers based on @thi.ng/rstream", "main": "./index.js", "typings": "./index.d.ts", @@ -31,8 +31,8 @@ "@thi.ng/api": "^4.0.4", "@thi.ng/checks": "^1.5.5", "@thi.ng/errors": "^0.1.4", - "@thi.ng/rstream": "^1.8.0", - "@thi.ng/transducers": "^1.11.1" + "@thi.ng/rstream": "^1.8.2", + "@thi.ng/transducers": "^1.12.0" }, "keywords": [ "ES6", diff --git a/packages/rstream-query/CHANGELOG.md b/packages/rstream-query/CHANGELOG.md index bbbf69808f..2bed2ee07f 100644 --- a/packages/rstream-query/CHANGELOG.md +++ b/packages/rstream-query/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.3.18](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-query@0.3.17...@thi.ng/rstream-query@0.3.18) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-query + + +## [0.3.17](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-query@0.3.16...@thi.ng/rstream-query@0.3.17) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream-query + ## [0.3.16](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-query@0.3.15...@thi.ng/rstream-query@0.3.16) (2018-06-21) diff --git a/packages/rstream-query/package.json b/packages/rstream-query/package.json index 87e495caeb..6a944b75cf 100644 --- a/packages/rstream-query/package.json +++ b/packages/rstream-query/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-query", - "version": "0.3.16", + "version": "0.3.18", "description": "@thi.ng/rstream based triple store & reactive query engine", "main": "./index.js", "typings": "./index.d.ts", @@ -29,13 +29,13 @@ }, "dependencies": { "@thi.ng/api": "^4.0.4", - "@thi.ng/associative": "^0.5.8", + "@thi.ng/associative": "^0.5.9", "@thi.ng/checks": "^1.5.5", "@thi.ng/equiv": "^0.1.5", "@thi.ng/errors": "^0.1.4", - "@thi.ng/rstream": "^1.8.0", - "@thi.ng/rstream-dot": "^0.2.17", - "@thi.ng/transducers": "^1.11.1" + "@thi.ng/rstream": "^1.8.2", + "@thi.ng/rstream-dot": "^0.2.19", + "@thi.ng/transducers": "^1.12.0" }, "keywords": [ "dataflow", diff --git a/packages/rstream/CHANGELOG.md b/packages/rstream/CHANGELOG.md index 49df2db48b..89ce620fee 100644 --- a/packages/rstream/CHANGELOG.md +++ b/packages/rstream/CHANGELOG.md @@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [1.8.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@1.8.1...@thi.ng/rstream@1.8.2) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/rstream + + +## [1.8.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@1.8.0...@thi.ng/rstream@1.8.1) (2018-07-03) + + +### Bug Fixes + +* **rstream:** unsubscribe on error in transduce() ([8c7d937](https://github.com/thi-ng/umbrella/commit/8c7d937)) + + + + # [1.8.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@1.7.3...@thi.ng/rstream@1.8.0) (2018-06-21) diff --git a/packages/rstream/package.json b/packages/rstream/package.json index 98754347b2..741718e4d0 100644 --- a/packages/rstream/package.json +++ b/packages/rstream/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream", - "version": "1.8.0", + "version": "1.8.2", "description": "Reactive multi-tap streams, dataflow & transformation pipeline constructs", "main": "./index.js", "typings": "./index.d.ts", @@ -29,12 +29,12 @@ }, "dependencies": { "@thi.ng/api": "^4.0.4", - "@thi.ng/associative": "^0.5.8", + "@thi.ng/associative": "^0.5.9", "@thi.ng/atom": "^1.4.2", "@thi.ng/checks": "^1.5.5", "@thi.ng/errors": "^0.1.4", "@thi.ng/paths": "^1.3.10", - "@thi.ng/transducers": "^1.11.1" + "@thi.ng/transducers": "^1.12.0" }, "keywords": [ "datastructure", diff --git a/packages/rstream/src/subs/transduce.ts b/packages/rstream/src/subs/transduce.ts index aabbf8ac6e..34c8d3be53 100644 --- a/packages/rstream/src/subs/transduce.ts +++ b/packages/rstream/src/subs/transduce.ts @@ -21,6 +21,7 @@ export function transduce(src: Subscription, tx: Transducer +## [0.3.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/sax@0.3.2...@thi.ng/sax@0.3.3) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/sax + ## [0.3.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/sax@0.3.1...@thi.ng/sax@0.3.2) (2018-06-21) diff --git a/packages/sax/package.json b/packages/sax/package.json index 2af5e9092b..2bd87c989a 100644 --- a/packages/sax/package.json +++ b/packages/sax/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/sax", - "version": "0.3.2", + "version": "0.3.3", "description": "Transducer-based, SAX-like, non-validating, speedy & tiny XML parser", "main": "./index.js", "typings": "./index.d.ts", @@ -29,8 +29,8 @@ }, "dependencies": { "@thi.ng/api": "^4.0.4", - "@thi.ng/transducers": "^1.11.1", - "@thi.ng/transducers-fsm": "^0.2.2" + "@thi.ng/transducers": "^1.12.0", + "@thi.ng/transducers-fsm": "^0.2.3" }, "keywords": [ "ES6", diff --git a/packages/transducers-fsm/CHANGELOG.md b/packages/transducers-fsm/CHANGELOG.md index 81bcfffe27..2d70b08504 100644 --- a/packages/transducers-fsm/CHANGELOG.md +++ b/packages/transducers-fsm/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.2.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers-fsm@0.2.2...@thi.ng/transducers-fsm@0.2.3) (2018-07-03) + + + + +**Note:** Version bump only for package @thi.ng/transducers-fsm + ## [0.2.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers-fsm@0.2.1...@thi.ng/transducers-fsm@0.2.2) (2018-06-21) diff --git a/packages/transducers-fsm/package.json b/packages/transducers-fsm/package.json index b825ef6d81..f95353bd49 100644 --- a/packages/transducers-fsm/package.json +++ b/packages/transducers-fsm/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/transducers-fsm", - "version": "0.2.2", + "version": "0.2.3", "description": "Transducer-based Finite State Machine transformer", "main": "./index.js", "typings": "./index.d.ts", @@ -29,7 +29,7 @@ }, "dependencies": { "@thi.ng/api": "^4.0.4", - "@thi.ng/transducers": "^1.11.1" + "@thi.ng/transducers": "^1.12.0" }, "keywords": [ "ES6", diff --git a/packages/transducers/CHANGELOG.md b/packages/transducers/CHANGELOG.md index 954027b8dd..32319661ce 100644 --- a/packages/transducers/CHANGELOG.md +++ b/packages/transducers/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [1.12.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.11.1...@thi.ng/transducers@1.12.0) (2018-07-03) + + +### Features + +* **transducers:** add ensureArray(), refactor reverse() ([677c7cc](https://github.com/thi-ng/umbrella/commit/677c7cc)) + + + + ## [1.11.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.11.0...@thi.ng/transducers@1.11.1) (2018-06-21) diff --git a/packages/transducers/package.json b/packages/transducers/package.json index 98645a96f0..d8fc38de86 100644 --- a/packages/transducers/package.json +++ b/packages/transducers/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/transducers", - "version": "1.11.1", + "version": "1.12.0", "description": "Lightweight transducer implementations for ES6 / TypeScript", "main": "./index.js", "typings": "./index.d.ts", diff --git a/packages/transducers/src/func/ensure-array.ts b/packages/transducers/src/func/ensure-array.ts new file mode 100644 index 0000000000..cf3634d417 --- /dev/null +++ b/packages/transducers/src/func/ensure-array.ts @@ -0,0 +1,14 @@ +import { isArray } from "@thi.ng/checks/is-array"; +import { ensureIterable } from "./ensure-iterable"; + +/** + * Helper function to avoid unnecessary copying if `x` is already an + * array. First checks if `x` is an array and if so returns it. Else + * attempts to obtain an iterator from `x` and if successful collects it + * as array and returns it. Throws error if `x` isn't iterable. + * + * @param x + */ +export function ensureArray(x: any): any[] { + return isArray(x) ? x : [...ensureIterable(x)]; +} diff --git a/packages/transducers/src/index.ts b/packages/transducers/src/index.ts index f6682ae689..b7540df973 100644 --- a/packages/transducers/src/index.ts +++ b/packages/transducers/src/index.ts @@ -97,6 +97,7 @@ export * from "./func/compr"; export * from "./func/constantly"; export * from "./func/deep-transform"; export * from "./func/delay"; +export * from "./func/ensure-array"; export * from "./func/ensure-iterable"; export * from "./func/even"; export * from "./func/fuzzy-match"; diff --git a/packages/transducers/src/iter/reverse.ts b/packages/transducers/src/iter/reverse.ts index 8694f05fb6..332b18ddac 100644 --- a/packages/transducers/src/iter/reverse.ts +++ b/packages/transducers/src/iter/reverse.ts @@ -1,20 +1,20 @@ -import { isArrayLike } from "@thi.ng/checks/is-arraylike"; +import { ensureArray } from "../func/ensure-array"; /** - * Yields iterator producing input in reverse order. - * Important: Input MUST be finite. Unless an + * Yields iterator which consumes input and yield its values in reverse + * order. Important: Input MUST be finite. + * * ``` * [...tx.reverse("hello world")] * // [ "d", "l", "r", "o", "w", " ", "o", "l", "l", "e", "h" ] * ``` + * * @param input */ export function* reverse(input: Iterable): IterableIterator { - if (!isArrayLike(input)) { - input = [...input]; - } - let n = (input).length; + const _input = ensureArray(input); + let n = _input.length; while (--n >= 0) { - yield input[n]; + yield _input[n]; } } diff --git a/packages/transducers/src/xform/partition-sync.ts b/packages/transducers/src/xform/partition-sync.ts index 3a20879cba..14656ffa8f 100644 --- a/packages/transducers/src/xform/partition-sync.ts +++ b/packages/transducers/src/xform/partition-sync.ts @@ -37,7 +37,7 @@ import { Reducer, Transducer } from "../api"; * * ``` * // passing `false` to disable tuple reset - * [...tx.iterator(tx.partitionSync(["a", "b"], (x) => x[0], false), src)] + * [...iterator(partitionSync(["a", "b"], (x) => x[0], false), src)] * // [ { a: ["a", 2], b: ["b", 10] }, * // { a: ["a", 2], b: ["b", 11] }, * // { a: ["a", 3], b: ["b", 11] } ]