diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..47967151a5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "node" \ No newline at end of file diff --git a/README.md b/README.md index 60392c5195..5b37082d0f 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,43 @@ # @thi.ng/umbrella -Mono-repository for thi.ng TypeScript/ES6 projects. +[![Travis status](https://api.travis-ci.org/thi-ng/umbrella.svg?branch=master)](https://travis-ci.org/thi-ng/umbrella) +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org/) + +Mono-repository for thi.ng TypeScript/ES6 projects, a collection of largely +data / transformation oriented packages. + +All packages are: + +- distributed as ES6 modules with bundled TypeScript typings & changelogs +- highly modular with largely only a single exported function / class per file +- provide re-exports of all their publics (`src/index.ts`) +- have either none or only @thi.ng internal runtime dependencies (see graph below) +- declare public interfaces, enums & types in an `src/api.ts` file (larger packages only) +- licensed under Apache Software License 2.0 ## Projects -| Projects | Version | -|----|----| -| [`@thi.ng/api`](./packages/api) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/api.svg)](https://www.npmjs.com/package/@thi.ng/api) | -| [`@thi.ng/bitstream`](./packages/bitstream) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/bitstream.svg)](https://www.npmjs.com/package/@thi.ng/bitstream) | -| [`@thi.ng/checks`](./packages/checks) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/checks.svg)](https://www.npmjs.com/package/@thi.ng/checks) | -| [`@thi.ng/csp`](./packages/csp) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/csp.svg)](https://www.npmjs.com/package/@thi.ng/csp) | -| [`@thi.ng/dcons`](./packages/dcons) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/dcons.svg)](https://www.npmjs.com/package/@thi.ng/dcons) | -| [`@thi.ng/hiccup`](./packages/hiccup) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/hiccup.svg)](https://www.npmjs.com/package/@thi.ng/hiccup) | -| [`@thi.ng/iterators`](./packages/iterators) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/iterators.svg)](https://www.npmjs.com/package/@thi.ng/iterators) | -| [`@thi.ng/rle-pack`](./packages/rle-pack) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rle-pack.svg)](https://www.npmjs.com/package/@thi.ng/rle-pack) | -| [`@thi.ng/rstream`](./packages/rstream) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream.svg)](https://www.npmjs.com/package/@thi.ng/rstream) | -| [`@thi.ng/rstream-csp`](./packages/rstream-csp) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream-csp.svg)](https://www.npmjs.com/package/@thi.ng/rstream-csp) | -| [`@thi.ng/rstream-log`](./packages/rstream-log) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream-log.svg)](https://www.npmjs.com/package/@thi.ng/rstream-log) | -| [`@thi.ng/transducers`](./packages/transducers) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/transducers.svg)](https://www.npmjs.com/package/@thi.ng/transducers) | -| [`@thi.ng/unionstruct`](./packages/unionstruct) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/unionstruct.svg)](https://www.npmjs.com/package/@thi.ng/unionstruct) | +| Projects | Version | | +|----|----|----| +| [`@thi.ng/api`](./packages/api) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/api.svg)](https://www.npmjs.com/package/@thi.ng/api) | [changelog](./packages/api/CHANGELOG.md) | +| [`@thi.ng/atom`](./packages/atom) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/atom.svg)](https://www.npmjs.com/package/@thi.ng/atom) | [changelog](./packages/atom/CHANGELOG.md) | +| [`@thi.ng/bitstream`](./packages/bitstream) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/bitstream.svg)](https://www.npmjs.com/package/@thi.ng/bitstream) | [changelog](./packages/bitstream/CHANGELOG.md) | +| [`@thi.ng/checks`](./packages/checks) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/checks.svg)](https://www.npmjs.com/package/@thi.ng/checks) | [changelog](./packages/checks/CHANGELOG.md) | +| [`@thi.ng/csp`](./packages/csp) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/csp.svg)](https://www.npmjs.com/package/@thi.ng/csp) | [changelog](./packages/csp/CHANGELOG.md) | +| [`@thi.ng/dcons`](./packages/dcons) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/dcons.svg)](https://www.npmjs.com/package/@thi.ng/dcons) | [changelog](./packages/dcons/CHANGELOG.md) | +| [`@thi.ng/hiccup`](./packages/hiccup) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/hiccup.svg)](https://www.npmjs.com/package/@thi.ng/hiccup) | [changelog](./packages/hiccup/CHANGELOG.md) | +| [`@thi.ng/iterators`](./packages/iterators) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/iterators.svg)](https://www.npmjs.com/package/@thi.ng/iterators) | [changelog](./packages/iterators/CHANGELOG.md) | +| [`@thi.ng/rle-pack`](./packages/rle-pack) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rle-pack.svg)](https://www.npmjs.com/package/@thi.ng/rle-pack) | [changelog](./packages/rle-pack/CHANGELOG.md) | +| [`@thi.ng/rstream`](./packages/rstream) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream.svg)](https://www.npmjs.com/package/@thi.ng/rstream) | [changelog](./packages/rstream/CHANGELOG.md) | +| [`@thi.ng/rstream-csp`](./packages/rstream-csp) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream-csp.svg)](https://www.npmjs.com/package/@thi.ng/rstream-csp) | [changelog](./packages/rstream-csp/CHANGELOG.md) | +| [`@thi.ng/rstream-log`](./packages/rstream-log) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/rstream-log.svg)](https://www.npmjs.com/package/@thi.ng/rstream-log) | [changelog](./packages/rstream-log/CHANGELOG.md) | +| [`@thi.ng/transducers`](./packages/transducers) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/transducers.svg)](https://www.npmjs.com/package/@thi.ng/transducers) | [changelog](./packages/transducers/CHANGELOG.md) | +| [`@thi.ng/unionstruct`](./packages/unionstruct) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/unionstruct.svg)](https://www.npmjs.com/package/@thi.ng/unionstruct) | [changelog](./packages/unionstruct/CHANGELOG.md) | ## Dependency graph +(This graph is updated automatically after each version update) + ![internal dependencies](./assets/deps.png) ## Building @@ -29,15 +45,15 @@ Mono-repository for thi.ng TypeScript/ES6 projects. ``` git clone https://github.com/thi-ng/umbrella.git cd umbrella -yarn install -lerna bootstrap -lerna exec yarn build --sort +yarn build ``` -### Testing +## Testing + +(TODO not all packages have tests yet) ``` -lerna exec yarn test +yarn test # or individually -lerna exec yarn test --scope @thi.ng/checks +lerna run test --scope @thi.ng/rstream ``` diff --git a/assets/deps.png b/assets/deps.png index 39fc6bc3c4..5d25f794f1 100644 Binary files a/assets/deps.png and b/assets/deps.png differ diff --git a/package.json b/package.json index afd7bb129f..287ea50fea 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,14 @@ "packages/*" ], "devDependencies": { - "lerna": "^2.8.0" + "lerna": "^2.8.0", + "tslint": "^5.9.1", + "typescript": "^2.6.2" }, "scripts": { - "depgraph": "scripts/depgraph && git add assets/deps.png && git commit -m 'update dep graph` && git push" + "build": "yarn install && lerna bootstrap && lerna run build --sort", + "depgraph": "scripts/depgraph && git add assets/deps.png && git commit -m 'docs: update dep graph' && git push", + "pub": "lerna publish && yarn depgraph", + "test": "yarn build && lerna run test" } } \ No newline at end of file diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md index 8c487fbb34..e1f9a9f631 100644 --- a/packages/api/CHANGELOG.md +++ b/packages/api/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.4.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.4.0...@thi.ng/api@1.4.1) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/api + + +# [1.4.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.3.0...@thi.ng/api@1.4.0) (2018-01-29) + + +### Features + +* **api:** update IWatch & mixin, boolean returns ([bddd5ce](https://github.com/thi-ng/umbrella/commit/bddd5ce)) + + + + # [1.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@1.2.1...@thi.ng/api@1.3.0) (2018-01-28) diff --git a/packages/api/package.json b/packages/api/package.json index ff115a22b1..8e80105eb7 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/api", - "version": "1.3.0", + "version": "1.4.1", "description": "Common, generic types & interfaces for thi.ng projects", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc decorators mixins", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -23,7 +24,7 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/checks": "^1.1.2" + "@thi.ng/checks": "^1.1.3" }, "keywords": [ "ES6", diff --git a/packages/api/src/api.ts b/packages/api/src/api.ts index 3aca9908ff..e5320aab4e 100644 --- a/packages/api/src/api.ts +++ b/packages/api/src/api.ts @@ -289,7 +289,7 @@ export interface IStack { export type Watch = (id: string, oldState: T, newState: T) => void; export interface IWatch { - addWatch(id: string, fn: Watch); - removeWatch(id: string); + addWatch(id: string, fn: Watch): boolean; + removeWatch(id: string): boolean; notifyWatches(oldState: T, newState: T); } diff --git a/packages/api/src/mixins/iwatch.ts b/packages/api/src/mixins/iwatch.ts index 0acb6b036a..e6ee395dcb 100644 --- a/packages/api/src/mixins/iwatch.ts +++ b/packages/api/src/mixins/iwatch.ts @@ -4,11 +4,19 @@ import { mixin } from "../mixin"; export const IWatch = mixin({ addWatch(id: string, fn: (id: string, oldState: any, newState: any) => void) { this._watches = this._watches || {}; + if (this._watches[id]) { + return false; + } this._watches[id] = fn; + return true; }, removeWatch(id: string) { this._watches = this._watches || {}; - delete this._watches[id]; + if (this._watches[id]) { + delete this._watches[id]; + return true; + } + return false; }, notifyWatches(oldState: any, newState: any) { const w = (this._watches = this._watches || {}), diff --git a/packages/api/test/index.ts b/packages/api/test/index.ts new file mode 100644 index 0000000000..be0596bd60 --- /dev/null +++ b/packages/api/test/index.ts @@ -0,0 +1,3 @@ +describe("api", () => { + it("tests pending"); +}); diff --git a/packages/api/test/tsconfig.json b/packages/api/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/api/test/tsconfig.json +++ b/packages/api/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/atom/.gitignore b/packages/atom/.gitignore new file mode 100644 index 0000000000..c84d20084f --- /dev/null +++ b/packages/atom/.gitignore @@ -0,0 +1,11 @@ +/bench +/build +/dev +/doc +/node_modules +.DS_Store +/bundle.* +*.log +*.tgz +*.js +*.d.ts diff --git a/packages/atom/.npmignore b/packages/atom/.npmignore new file mode 100644 index 0000000000..538f8b608d --- /dev/null +++ b/packages/atom/.npmignore @@ -0,0 +1,14 @@ +bench/* +build/* +dev/* +node_modules +src* +test* +bundle.* +tsconfig.json +webpack.config.js +*.html +*.tgz +!doc/* +!*.d.ts +!*.js diff --git a/packages/atom/CHANGELOG.md b/packages/atom/CHANGELOG.md new file mode 100644 index 0000000000..51915b823c --- /dev/null +++ b/packages/atom/CHANGELOG.md @@ -0,0 +1,51 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + + +## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@0.2.0...@thi.ng/atom@0.2.1) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/atom + + +# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@0.1.2...@thi.ng/atom@0.2.0) (2018-01-29) + + +### Features + +* **atom:** add nested path getter / setter compilers ([5dce8a2](https://github.com/thi-ng/umbrella/commit/5dce8a2)) + + + + + +## [0.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@0.1.1...@thi.ng/atom@0.1.2) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/atom + + +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@0.1.0...@thi.ng/atom@0.1.1) (2018-01-29) + + +### Bug Fixes + +* **atom:** cursor IWatch impls (replace stubs) ([cca801b](https://github.com/thi-ng/umbrella/commit/cca801b)) + + + + + +# 0.1.0 (2018-01-29) + + +### Features + +* **atom:** add Cursor, update interfaces, types, readme ([04c3d59](https://github.com/thi-ng/umbrella/commit/04c3d59)) +* **atom:** re-import atom package from MBP2010, update main readme ([fefc283](https://github.com/thi-ng/umbrella/commit/fefc283)) diff --git a/packages/atom/LICENSE b/packages/atom/LICENSE new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/packages/atom/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/atom/README.md b/packages/atom/README.md new file mode 100644 index 0000000000..5a9d9c83e9 --- /dev/null +++ b/packages/atom/README.md @@ -0,0 +1,81 @@ +# @thi.ng/atom + +[![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/atom.svg)](https://www.npmjs.com/package/@thi.ng/atom) + +## About + +Clojure inspired mutable wrappers for (usually) immutable values, with support for watches. + +TODO + +## Installation + +``` +yarn add @thi.ng/atom +``` + +## Usage examples + +### Atom + +```typescript +import * as atom from "@thi.ng/atom"; + +const a = new atom.Atom(23); + +// obtain value via deref() +a.deref(); +// 23 + +// add watch to observe value changes +a.addWatch("foo", (id, prev, curr) => console.log(`${id}: ${prev} -> ${curr}`)); +// true + +a.swap((val)=> val + 1); +// foo: 23 -> 24 + +a.reset(42); +// foo: 24 -> 42 +``` + +### Cursor + +```typescript +// main state +main = new atom.Atom({ a: { b: { c: 23 }, d: { e: 42 } }, f: 66 }); + +// cursor to `c` value +cursor = new atom.Cursor(main, "a.b.c"); +// or +cursor = new atom.Cursor(main, ["a","b","c"]); + +// alternatively provide path implicitly via lookup & update functions +// both fns will be called with cursor's parent state +// this allows the cursor implementation to work with any data structure +// as long as the updater DOES NOT mutate in place +cursor = new atom.Cursor( + main, + (s) => s.a.b.c, + (s, x) => ({...s, a: {...s.a, b: {...s.a.b, c: x}}}) +); + +// add watch just as with Atom +cursor.addWatch("foo", console.log); + +cursor.deref() +// 23 + +cursor.swap(x => x + 1); +// foo 23 24 + +main.deref() +// { a: 24, b: 42 } +``` + +## Authors + +- Karsten Schmidt + +## License + +© 2018 Karsten Schmidt // Apache Software License 2.0 diff --git a/packages/atom/package.json b/packages/atom/package.json new file mode 100644 index 0000000000..5d8ae785e2 --- /dev/null +++ b/packages/atom/package.json @@ -0,0 +1,36 @@ +{ + "name": "@thi.ng/atom", + "version": "0.2.1", + "description": "Mutable wrapper for a immutable values", + "main": "./index.js", + "typings": "./index.d.ts", + "repository": "https://github.com/thi-ng/umbrella", + "author": "Karsten Schmidt ", + "license": "Apache-2.0", + "scripts": { + "build": "yarn clean && tsc --declaration", + "clean": "rm -rf *.js *.d.ts build doc", + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" + }, + "devDependencies": { + "@types/mocha": "^2.2.46", + "@types/node": "^9.3.0", + "mocha": "^5.0.0", + "ts-loader": "^3.3.1", + "typedoc": "^0.9.0", + "typescript": "^2.6.2", + "webpack": "^3.10.0" + }, + "dependencies": { + "@thi.ng/api": "^1.4.1" + }, + "keywords": [ + "ES6", + "typescript" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/atom/src/api.ts b/packages/atom/src/api.ts new file mode 100644 index 0000000000..75ad5ab202 --- /dev/null +++ b/packages/atom/src/api.ts @@ -0,0 +1,13 @@ +import * as api from "@thi.ng/api/api"; + +export type SwapFn = (curr: T, ...args: any[]) => T; + +export interface ReadonlyAtom extends + api.IDeref, + api.IWatch { +} + +export interface IAtom extends ReadonlyAtom { + reset(val: T): T; + swap(fn: SwapFn, ...args: any[]): T; +} diff --git a/packages/atom/src/atom.ts b/packages/atom/src/atom.ts new file mode 100644 index 0000000000..de4f27b744 --- /dev/null +++ b/packages/atom/src/atom.ts @@ -0,0 +1,56 @@ +import { IEquiv, Watch } from "@thi.ng/api/api"; +import { IWatch } from "@thi.ng/api/mixins/iwatch"; + +import { IAtom, SwapFn } from "./api"; + +/** + * Mutable wrapper for an (usually) immutable value. + * Support for watches. + */ +@IWatch +export class Atom implements + IAtom, + IEquiv { + + protected value: T; + + constructor(val?: T) { + this.value = val; + } + + deref() { + return this.value; + } + + equiv(o: any) { + return this === o; + } + + reset(val: T) { + const old = this.value; + this.value = val; + this.notifyWatches(old, val); + return this.value; + } + + swap(fn: SwapFn, ...args: any[]) { + const old = this.value; + args.unshift(old); + this.value = fn.apply(null, args); + this.notifyWatches(old, this.value); + return this.value; + } + + // mixin stub + addWatch(id: string, fn: Watch) { + return false; + } + + // mixin stub + removeWatch(id: string) { + return false; + } + + // mixin stub + notifyWatches(oldState: T, newState: T) { } +} diff --git a/packages/atom/src/cursor.ts b/packages/atom/src/cursor.ts new file mode 100644 index 0000000000..eae193312a --- /dev/null +++ b/packages/atom/src/cursor.ts @@ -0,0 +1,87 @@ +import { IID, IRelease, Watch } from "@thi.ng/api/api"; +import { isArray } from "@thi.ng/checks/is-array"; +import { isFunction } from "@thi.ng/checks/is-function"; +import { isString } from "@thi.ng/checks/is-string"; + +import { IAtom, SwapFn } from "./api"; +import { Atom } from "./atom"; +import { getter, setter } from "./path"; + +export class Cursor implements + IAtom, + IID, + IRelease { + + static NEXT_ID = 0; + + readonly id: string; + parent: IAtom; + + protected local: Atom; + protected lookup: (s: any) => T; + protected selfUpdate: boolean; + + constructor(parent: IAtom, path: PropertyKey | PropertyKey[]); + constructor(parent: IAtom, lookup: (s: any) => T, update: (s: any, v: T) => any); + constructor(parent: IAtom, ...opts: any[]) { + this.parent = parent; + this.id = `cursor-${Cursor.NEXT_ID++}`; + this.selfUpdate = false; + let lookup, update; + if (isString(opts[0]) || isArray(opts[0])) { + lookup = getter(opts[0]); + update = setter(opts[0]); + } else if (isFunction(opts[0]) && isFunction(opts[1])) { + [lookup, update] = opts; + } else { + throw new Error("illegal args"); + } + this.local = new Atom(lookup(parent.deref())); + this.local.addWatch(this.id, (_, prev, curr) => { + if (prev !== curr) { + this.selfUpdate = true; + parent.swap((state) => update(state, curr)); + this.selfUpdate = false; + } + }); + parent.addWatch(this.id, (_, prev, curr) => { + if (!this.selfUpdate) { + const cval = lookup(curr); + if (cval !== lookup(prev)) { + this.local.reset(cval); + } + } + }); + } + + deref() { + return this.local.deref(); + } + + release() { + this.local.removeWatch(this.id); + this.parent.removeWatch(this.id); + delete this.local; + return true; + } + + reset(val: T) { + return this.local.reset(val); + } + + swap(fn: SwapFn, ...args: any[]) { + return this.local.swap.apply(this.local, [fn, ...args]); + } + + addWatch(id: string, fn: Watch) { + return this.local.addWatch(id, fn); + } + + removeWatch(id: string): boolean { + return this.local.removeWatch(id); + } + + notifyWatches(oldState: T, newState: T) { + return this.local.notifyWatches(oldState, newState); + } +} diff --git a/packages/atom/src/index.ts b/packages/atom/src/index.ts new file mode 100644 index 0000000000..1c481343f2 --- /dev/null +++ b/packages/atom/src/index.ts @@ -0,0 +1,3 @@ +export * from "./atom"; +export * from "./cursor"; +export * from "./path"; \ No newline at end of file diff --git a/packages/atom/src/path.ts b/packages/atom/src/path.ts new file mode 100644 index 0000000000..6e085c7279 --- /dev/null +++ b/packages/atom/src/path.ts @@ -0,0 +1,30 @@ +import { isArray } from "@thi.ng/checks/is-array"; +import { isString } from "@thi.ng/checks/is-string"; + +function compS(k, f) { + return (s, v) => ({ ...s, [k]: f((s || {})[k], v) }); +} + +function compG(k, f) { + return (s) => s ? f(s[k]) : undefined; +} + +export function getter(path: PropertyKey | PropertyKey[]) { + const ks = isArray(path) ? path : isString(path) ? path.split(".") : [path], + kl = ks.pop(); + let f = (s) => s ? s[kl] : undefined; + for (let i = ks.length - 1; i >= 0; i--) { + f = compG(ks[i], f); + } + return f; +} + +export function setter(path: PropertyKey | PropertyKey[]) { + const ks = isArray(path) ? path : isString(path) ? path.split(".") : [path], + kl = ks.pop(); + let f = (s, v) => ({ ...(s || {}), [kl]: v }); + for (let i = ks.length - 1; i >= 0; i--) { + f = compS(ks[i], f); + } + return f; +} diff --git a/packages/atom/test/atom.ts b/packages/atom/test/atom.ts new file mode 100644 index 0000000000..996c8c1a57 --- /dev/null +++ b/packages/atom/test/atom.ts @@ -0,0 +1,42 @@ +import * as assert from "assert"; +import { Atom } from "../src/index"; + +describe("atom", function () { + + let a: Atom; + + beforeEach(() => { + a = new Atom(23); + }); + + it("can be deref'd", () => { + assert.equal(a.deref(), 23); + }); + + it("can be reset", () => { + assert.equal(a.reset(24), 24); + assert.equal(a.deref(), 24); + }); + + it("can be swapped", () => { + assert.equal(a.swap((x) => x + 1), 24); + assert.equal(a.deref(), 24); + }); + + it("can add & remove watch", () => { + assert(a.addWatch("foo", () => { }), "can't add watch"); + assert((a)._watches && (a)._watches.foo, "watch missing"); + assert(a.removeWatch("foo"), "can't remove watch"); + assert(!a.removeWatch("foo"), "should fail to remove invalid watch id"); + }); + + it("can be watched", () => { + a.addWatch("foo", (id, prev, curr) => { + assert.equal(id, "foo", "wrong id"); + assert.equal(prev, 23, "wrong prev"); + assert.equal(curr, 24, "wrong curr"); + }); + a.swap((x) => x + 1); + }); + +}); diff --git a/packages/atom/test/cursor.ts b/packages/atom/test/cursor.ts new file mode 100644 index 0000000000..773d72da8e --- /dev/null +++ b/packages/atom/test/cursor.ts @@ -0,0 +1,64 @@ +import * as assert from "assert"; +import { Atom, Cursor } from "../src/index"; + +describe("cursor w/ path", function () { + + let a: Atom; + let c: Cursor; + let src; + + beforeEach(() => { + src = { a: { b: { c: 23 }, d: { e: 42 } }, f: 66 }; + a = new Atom(src); + }); + + it("can be deref'd (a)", () => { + c = new Cursor(a, "a"); + assert.deepStrictEqual(c.deref(), src.a); + }); + + it("can be deref'd (a.b)", () => { + c = new Cursor(a, "a.b"); + assert.deepStrictEqual(c.deref(), src.a.b); + }); + + it("can be deref'd (a.b.c)", () => { + c = new Cursor(a, "a.b.c"); + assert.equal(c.deref(), src.a.b.c); + }); + + it("doesn't fail w/ invalid path", () => { + c = new Cursor(a, "a.b.x.y.z"); + assert.strictEqual(c.deref(), undefined); + }); + + it("can be swapped'd (a.b.c)", () => { + c = new Cursor(a, "a.b.c"); + assert.equal(c.swap(x => x + 1), src.a.b.c + 1); + assert.equal(c.deref(), src.a.b.c + 1); + assert.equal(a.deref().a.b.c, src.a.b.c + 1); + assert.strictEqual(a.deref().a.d, src.a.d); + assert.strictEqual(a.deref().f, src.f); + }); + + it("can be reset (a.b.c)", () => { + c = new Cursor(a, "a.b.c"); + assert.equal(c.reset(100), 100); + assert.equal(c.deref(), 100); + assert.equal(a.deref().a.b.c, 100); + assert.strictEqual(a.deref().a.d, src.a.d); + assert.strictEqual(a.deref().f, src.f); + }); + + it("can update invalid path (x.y.z)", () => { + c = new Cursor(a, "x.y.z"); + assert.equal(c.swap(x => x != null ? x + 1 : 0), 0); + assert.equal(c.deref(), 0); + assert.equal(c.swap(x => x != null ? x + 1 : 0), 1); + assert.equal(c.deref(), 1); + assert.equal(c.reset(100), 100); + assert.equal(c.deref(), 100); + assert.equal(a.deref().x.y.z, 100); + assert.strictEqual(src.x, undefined); + }); +}); diff --git a/packages/atom/test/tsconfig.json b/packages/atom/test/tsconfig.json new file mode 100644 index 0000000000..e077d51a4c --- /dev/null +++ b/packages/atom/test/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../build", + "noUnusedParameters": false + }, + "include": [ + "./**/*.ts", + "../src/**/*.ts" + ] +} \ No newline at end of file diff --git a/packages/atom/tsconfig.json b/packages/atom/tsconfig.json new file mode 100644 index 0000000000..7e59425303 --- /dev/null +++ b/packages/atom/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": ".", + "noUnusedParameters": false + }, + "include": [ + "./src/**/*.ts" + ] +} \ No newline at end of file diff --git a/packages/bitstream/CHANGELOG.md b/packages/bitstream/CHANGELOG.md index 5d3663bdbf..35199b3c60 100644 --- a/packages/bitstream/CHANGELOG.md +++ b/packages/bitstream/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.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/bitstream@0.3.2...@thi.ng/bitstream@0.3.3) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/bitstream + ## [0.3.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/bitstream@0.3.1...@thi.ng/bitstream@0.3.2) (2018-01-28) diff --git a/packages/bitstream/package.json b/packages/bitstream/package.json index b92cab0380..dd7022e673 100644 --- a/packages/bitstream/package.json +++ b/packages/bitstream/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/bitstream", - "version": "0.3.2", + "version": "0.3.3", "description": "ES6 iterator based read/write bit streams & support for variable word widths", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", diff --git a/packages/bitstream/test/tsconfig.json b/packages/bitstream/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/bitstream/test/tsconfig.json +++ b/packages/bitstream/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/checks/CHANGELOG.md b/packages/checks/CHANGELOG.md index 067ce2dd04..b319914a9d 100644 --- a/packages/checks/CHANGELOG.md +++ b/packages/checks/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. + +## [1.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/checks@1.1.2...@thi.ng/checks@1.1.3) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/checks + ## [1.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/checks@1.1.1...@thi.ng/checks@1.1.2) (2018-01-28) diff --git a/packages/checks/package.json b/packages/checks/package.json index 111c2cb793..f0fee5acf3 100644 --- a/packages/checks/package.json +++ b/packages/checks/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/checks", - "version": "1.1.2", + "version": "1.1.3", "description": "Single-function sub-modules for type, feature & value checks", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", diff --git a/packages/checks/test/tsconfig.json b/packages/checks/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/checks/test/tsconfig.json +++ b/packages/checks/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/checks/tsconfig.json b/packages/checks/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/checks/tsconfig.json +++ b/packages/checks/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/csp/CHANGELOG.md b/packages/csp/CHANGELOG.md index 842c96c01c..fd890c782d 100644 --- a/packages/csp/CHANGELOG.md +++ b/packages/csp/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.3.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@0.3.5...@thi.ng/csp@0.3.6) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/csp + + +## [0.3.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@0.3.4...@thi.ng/csp@0.3.5) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/csp + + +## [0.3.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@0.3.3...@thi.ng/csp@0.3.4) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/csp + ## [0.3.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@0.3.2...@thi.ng/csp@0.3.3) (2018-01-28) diff --git a/packages/csp/package.json b/packages/csp/package.json index 32e3290a8b..d56225faaf 100644 --- a/packages/csp/package.json +++ b/packages/csp/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/csp", - "version": "0.3.3", + "version": "0.3.6", "description": "ES6 promise based CSP implementation", "main": "./index.js", "typings": "./index.d.ts", @@ -8,14 +8,15 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", + "clean": "rm -rf *.js *.d.ts build doc utils", + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/index.js", "testasync": "tsc -p test && node build/test/async.js", "testfile": "tsc -p test && node build/test/file.js", "testgraph": "tsc -p test && node build/test/graph.js", - "testnode": "tsc -p test && node build/test/node.js", - "clean": "rm -rf *.js *.d.ts build doc utils", - "pub": "yarn run build && yarn publish --access public" + "testnode": "tsc -p test && node build/test/node.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -27,9 +28,9 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/api": "^1.3.0", - "@thi.ng/dcons": "^0.1.5", - "@thi.ng/transducers": "^1.0.0" + "@thi.ng/api": "^1.4.1", + "@thi.ng/dcons": "^0.1.7", + "@thi.ng/transducers": "^1.0.3" }, "keywords": [ "async", diff --git a/packages/csp/test/index.ts b/packages/csp/test/index.ts new file mode 100644 index 0000000000..5bc2940287 --- /dev/null +++ b/packages/csp/test/index.ts @@ -0,0 +1,3 @@ +describe("csp", () => { + it("tests pending"); +}); diff --git a/packages/csp/test/tsconfig.json b/packages/csp/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/csp/test/tsconfig.json +++ b/packages/csp/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/csp/tsconfig.json b/packages/csp/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/csp/tsconfig.json +++ b/packages/csp/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/dcons/CHANGELOG.md b/packages/dcons/CHANGELOG.md index f93423a221..d0ebcfe880 100644 --- a/packages/dcons/CHANGELOG.md +++ b/packages/dcons/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.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@0.1.6...@thi.ng/dcons@0.1.7) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/dcons + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@0.1.5...@thi.ng/dcons@0.1.6) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/dcons + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@0.1.4...@thi.ng/dcons@0.1.5) (2018-01-28) diff --git a/packages/dcons/package.json b/packages/dcons/package.json index 1f1557ea68..4b1e7a99a3 100644 --- a/packages/dcons/package.json +++ b/packages/dcons/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dcons", - "version": "0.1.5", + "version": "0.1.7", "description": "Comprehensive doubly linked list structure w/ iterator support", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -23,7 +24,7 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/api": "^1.3.0" + "@thi.ng/api": "^1.4.1" }, "keywords": [ "datastructure", diff --git a/packages/dcons/test/index.ts b/packages/dcons/test/index.ts index 3e79406870..87ea10f0dd 100644 --- a/packages/dcons/test/index.ts +++ b/packages/dcons/test/index.ts @@ -3,8 +3,27 @@ import * as assert from "assert"; import { DCons } from "../src/index"; describe("DCons", () => { - it("foo", () => { - const a = new DCons([1, 2, 3, 4, 5, 6]); + let a: DCons, src; + beforeEach(() => { + src = [1, 2, 3, 4, 5]; + a = new DCons(src); + }); + + it("is instanceof", () => { assert(a instanceof DCons); }); -}); + + it("has length", () => { + assert.equal(a.length, 5); + a = new DCons(); + assert.equal(a.length, 0); + }); + + it("is iterable", () => { + assert.deepEqual([...a], src); + }); + + it("works as stack"); + + it("works as queue"); +}); \ No newline at end of file diff --git a/packages/dcons/test/tsconfig.json b/packages/dcons/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/dcons/test/tsconfig.json +++ b/packages/dcons/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/dcons/tsconfig.json b/packages/dcons/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/dcons/tsconfig.json +++ b/packages/dcons/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/hiccup/CHANGELOG.md b/packages/hiccup/CHANGELOG.md index dafcc9ecbc..1be5bfce35 100644 --- a/packages/hiccup/CHANGELOG.md +++ b/packages/hiccup/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.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup@0.1.3...@thi.ng/hiccup@0.1.4) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/hiccup + ## [0.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup@0.1.2...@thi.ng/hiccup@0.1.3) (2018-01-28) diff --git a/packages/hiccup/package.json b/packages/hiccup/package.json index b76d2be69f..4cc231ddf5 100644 --- a/packages/hiccup/package.json +++ b/packages/hiccup/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hiccup", - "version": "0.1.3", + "version": "0.1.4", "description": "HTML/SVG/XML serialization of nested data structures, iterables & closures", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", diff --git a/packages/hiccup/test/tsconfig.json b/packages/hiccup/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/hiccup/test/tsconfig.json +++ b/packages/hiccup/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/hiccup/tsconfig.json b/packages/hiccup/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/hiccup/tsconfig.json +++ b/packages/hiccup/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/iterators/CHANGELOG.md b/packages/iterators/CHANGELOG.md index d145d251e1..1feeacd6e3 100644 --- a/packages/iterators/CHANGELOG.md +++ b/packages/iterators/CHANGELOG.md @@ -3,6 +3,31 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [4.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/iterators@3.2.4...@thi.ng/iterators@4.0.0) (2018-01-29) + + +### Code Refactoring + +* **iterators:** remove default exports ([651d07c](https://github.com/thi-ng/umbrella/commit/651d07c)) + + +### BREAKING CHANGES + +* **iterators:** switch back to named function exports for project consistency +and following lead from tslint (https://palantir.github.io/tslint/rules/no-default-export/) + + + + + +## [3.2.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/iterators@3.2.3...@thi.ng/iterators@3.2.4) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/iterators + ## [3.2.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/iterators@3.2.2...@thi.ng/iterators@3.2.3) (2018-01-28) diff --git a/packages/iterators/README.md b/packages/iterators/README.md index e19858f5c2..817e31721d 100644 --- a/packages/iterators/README.md +++ b/packages/iterators/README.md @@ -4,7 +4,7 @@ ## Overview -Collection of approx. 50 composable, iterator-centric data processing functions, +Collection of ~50 composable, iterator-centric data processing functions, largely implemented as ES6 iterators / generators, inspired by [clojure.core](http://clojure.github.io/clojure/clojure.core-api.html) API. Written in TypeScript. @@ -17,17 +17,15 @@ See [changelog](https://github.com/thi-ng/iterators/blob/master/CHANGELOG.md) fo yarn add @thi.ng/iterators ``` -All functions are defined as sub-modules and exposed as default exports. This is an additional feature. The full library can still be imported as before. Function sub-modules use *Kebab case* whereas function names are in *Camel case*. +All functions are defined as sub-modules and re-exported to allow the full +library to be imported if desired. Sub-module file names use *Kebab case*, +whereas function names are in *Camel case*. ```js -// import entire library -let ti = require("@thi.ng/iterators"); - -// single function (ES5) -let map = require("@thi.ng/iterators/map").default; - +// import all +import * as ti from "@thi.ng/iterators"; // single function (ES6 / TS) -import map from "@thi.ng/iterators/map"; +import { partitionBy } from "@thi.ng/iterators/partition-by"; ``` ## API diff --git a/packages/iterators/package.json b/packages/iterators/package.json index 6117f0f102..411e369634 100644 --- a/packages/iterators/package.json +++ b/packages/iterators/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/iterators", - "version": "3.2.3", + "version": "4.0.0", "description": "clojure.core inspired, composable ES6 iterators & generators", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -23,7 +24,7 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/dcons": "^0.1.5" + "@thi.ng/dcons": "^0.1.7" }, "keywords": [ "clojure", diff --git a/packages/iterators/src/butlast.ts b/packages/iterators/src/butlast.ts index 4daf3fdc11..ecf1ba61d2 100644 --- a/packages/iterators/src/butlast.ts +++ b/packages/iterators/src/butlast.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* butLast(input: Iterable) { +export function* butLast(input: Iterable) { let iter = iterator(input), v: IteratorResult, prev: T, diff --git a/packages/iterators/src/cached.ts b/packages/iterators/src/cached.ts index 8a19ee1e93..567b05cde5 100644 --- a/packages/iterators/src/cached.ts +++ b/packages/iterators/src/cached.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function cached(input: Iterable) { +export function cached(input: Iterable) { let cache: T[] = [], iter = iterator(input), done = false; diff --git a/packages/iterators/src/concat.ts b/packages/iterators/src/concat.ts index 0d97bdb415..7e620c7ae6 100644 --- a/packages/iterators/src/concat.ts +++ b/packages/iterators/src/concat.ts @@ -1,7 +1,7 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; import { ensureIterable } from "./ensure"; -export default function* concat(...inputs: Iterable[]) { +export function* concat(...inputs: Iterable[]) { let iter = iterator(inputs), v: IteratorResult>; while (((v = iter.next()), !v.done)) { diff --git a/packages/iterators/src/constantly.ts b/packages/iterators/src/constantly.ts index 1e18d16714..dfd4499078 100644 --- a/packages/iterators/src/constantly.ts +++ b/packages/iterators/src/constantly.ts @@ -1,3 +1,3 @@ -export default function constantly(x: T): (...args: any[]) => T { +export function constantly(x: T): (...args: any[]) => T { return () => x; } diff --git a/packages/iterators/src/consume.ts b/packages/iterators/src/consume.ts index a1f7377ed6..ed7ed0d143 100644 --- a/packages/iterators/src/consume.ts +++ b/packages/iterators/src/consume.ts @@ -1,4 +1,4 @@ -export default function consume(iter: Iterator, n = Number.POSITIVE_INFINITY) { +export function consume(iter: Iterator, n = Number.POSITIVE_INFINITY) { while (n-- > 0 && !iter.next().done) { } return iter; } diff --git a/packages/iterators/src/cycle.ts b/packages/iterators/src/cycle.ts index 0f162037f2..e8a9fca1ff 100644 --- a/packages/iterators/src/cycle.ts +++ b/packages/iterators/src/cycle.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* cycle(input: Iterable) { +export function* cycle(input: Iterable) { let cache: T[] = [], iter = iterator(input), v: IteratorResult; diff --git a/packages/iterators/src/dedupe-with.ts b/packages/iterators/src/dedupe-with.ts index 5f20af070e..585b234e94 100644 --- a/packages/iterators/src/dedupe-with.ts +++ b/packages/iterators/src/dedupe-with.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* dedupeWith(equiv: (a: T, b: T) => boolean, input: Iterable) { +export function* dedupeWith(equiv: (a: T, b: T) => boolean, input: Iterable) { let iter = iterator(input), v: IteratorResult, prev: T; diff --git a/packages/iterators/src/dedupe.ts b/packages/iterators/src/dedupe.ts index 9b5811bd8b..6790c1be9f 100644 --- a/packages/iterators/src/dedupe.ts +++ b/packages/iterators/src/dedupe.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* dedupe(input: Iterable) { +export function* dedupe(input: Iterable) { let iter = iterator(input), v: IteratorResult, prev: T; diff --git a/packages/iterators/src/dense.ts b/packages/iterators/src/dense.ts index 7e12fe3f6d..d62cd06de3 100644 --- a/packages/iterators/src/dense.ts +++ b/packages/iterators/src/dense.ts @@ -1,5 +1,5 @@ -import filter from "./filter"; +import { filter } from "./filter"; -export default function dense(input: Iterable) { +export function dense(input: Iterable) { return filter(x => x != null, input); } diff --git a/packages/iterators/src/drop-nth.ts b/packages/iterators/src/drop-nth.ts index 6fd0129cac..d1404b2f73 100644 --- a/packages/iterators/src/drop-nth.ts +++ b/packages/iterators/src/drop-nth.ts @@ -1,8 +1,8 @@ -import iterator from "./iterator"; -import take from "./take"; +import { iterator } from "./iterator"; +import { take } from "./take"; import { ensureIterable } from "./ensure"; -export default function* dropNth(n: number, input: Iterable) { +export function* dropNth(n: number, input: Iterable) { let iter = ensureIterable(iterator(input)); do { yield* take(n - 1, iter); diff --git a/packages/iterators/src/drop-while.ts b/packages/iterators/src/drop-while.ts index 34b9d9bf3d..e18351a180 100644 --- a/packages/iterators/src/drop-while.ts +++ b/packages/iterators/src/drop-while.ts @@ -1,6 +1,6 @@ import { ensureIterator } from "./ensure"; -export default function* dropWhile(pred: (x: T) => boolean, input: Iterable) { +export function* dropWhile(pred: (x: T) => boolean, input: Iterable) { let iter = ensureIterator(input), v: IteratorResult; while (((v = iter.next()), !v.done && pred(v.value) === true)) { } diff --git a/packages/iterators/src/drop.ts b/packages/iterators/src/drop.ts index b860ab07bc..f3b3cfb3fd 100644 --- a/packages/iterators/src/drop.ts +++ b/packages/iterators/src/drop.ts @@ -1,7 +1,7 @@ -import consume from "./consume"; +import { consume } from "./consume"; import { ensureIterator } from "./ensure"; -export default function* drop(n: number, input: Iterable) { +export function* drop(n: number, input: Iterable) { let iter = ensureIterator(input); consume(iter, n); yield* iter; diff --git a/packages/iterators/src/ensure.ts b/packages/iterators/src/ensure.ts index 1de7325bb5..0533fba0e5 100644 --- a/packages/iterators/src/ensure.ts +++ b/packages/iterators/src/ensure.ts @@ -1,4 +1,4 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; export function ensureIterable(x: any): IterableIterator { if (!(x != null && x[Symbol.iterator])) { diff --git a/packages/iterators/src/every.ts b/packages/iterators/src/every.ts index 4b6eb88a11..15970014a4 100644 --- a/packages/iterators/src/every.ts +++ b/packages/iterators/src/every.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function every(pred: (x: T) => boolean, input: Iterable) { +export function every(pred: (x: T) => boolean, input: Iterable) { let iter = iterator(input), v: IteratorResult, empty = true; diff --git a/packages/iterators/src/filter.ts b/packages/iterators/src/filter.ts index abcc0c8a36..00dfb0d0e6 100644 --- a/packages/iterators/src/filter.ts +++ b/packages/iterators/src/filter.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* filter(pred: (x: T) => boolean, input: Iterable) { +export function* filter(pred: (x: T) => boolean, input: Iterable) { let iter = iterator(input), v: IteratorResult; while (((v = iter.next()), !v.done)) { diff --git a/packages/iterators/src/flatten-with.ts b/packages/iterators/src/flatten-with.ts index 46a6b9aa2a..1fb4e76164 100644 --- a/packages/iterators/src/flatten-with.ts +++ b/packages/iterators/src/flatten-with.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* flattenWith(tx: (x: any) => any, input: Iterable): IterableIterator { +export function* flattenWith(tx: (x: any) => any, input: Iterable): IterableIterator { let iter = iterator(input), v: IteratorResult, val, res; while (((v = iter.next()), !v.done)) { diff --git a/packages/iterators/src/flatten.ts b/packages/iterators/src/flatten.ts index 1906393108..6ab857b428 100644 --- a/packages/iterators/src/flatten.ts +++ b/packages/iterators/src/flatten.ts @@ -1,8 +1,8 @@ -import flattenWith from "./flatten-with"; +import { flattenWith } from "./flatten-with"; import { maybeIterator } from "./iterator"; import { maybeObjectIterator } from "./object-iterator"; -export default function flatten(input: Iterable, includeObjects = true) { +export function flatten(input: Iterable, includeObjects = true) { return flattenWith( (x) => (typeof x !== "string" && diff --git a/packages/iterators/src/fnil.ts b/packages/iterators/src/fnil.ts index 7456d2263d..7b0d85d138 100644 --- a/packages/iterators/src/fnil.ts +++ b/packages/iterators/src/fnil.ts @@ -1,4 +1,4 @@ -export default function fnil(fn: (...args: any[]) => any, ...ctors: (() => any)[]) { +export function fnil(fn: (...args: any[]) => any, ...ctors: (() => any)[]) { let [cta, ctb, ctc] = ctors; switch (ctors.length) { case 1: diff --git a/packages/iterators/src/fork.ts b/packages/iterators/src/fork.ts index 0e1b54af5f..948c46ab71 100644 --- a/packages/iterators/src/fork.ts +++ b/packages/iterators/src/fork.ts @@ -1,8 +1,8 @@ import { DCons } from "@thi.ng/dcons"; -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function fork(src: Iterable, cacheLimit = 16) { +export function fork(src: Iterable, cacheLimit = 16) { const iter = iterator(src), cache = new DCons(), forks = []; diff --git a/packages/iterators/src/frequencies.ts b/packages/iterators/src/frequencies.ts index adaf531b88..1052a8078d 100644 --- a/packages/iterators/src/frequencies.ts +++ b/packages/iterators/src/frequencies.ts @@ -1,11 +1,11 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; export interface FrequencyPair { [0]: T; [1]: number; } -export default function* frequencies(input: Iterable, key?: (v: T) => any): IterableIterator[]> { +export function* frequencies(input: Iterable, key?: (v: T) => any): IterableIterator[]> { let freqs = {}, iter = iterator(input), v: IteratorResult; diff --git a/packages/iterators/src/group-by.ts b/packages/iterators/src/group-by.ts index 5cfe14d4aa..408cabe206 100644 --- a/packages/iterators/src/group-by.ts +++ b/packages/iterators/src/group-by.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function groupBy(key: (v) => any, input: Iterable): { [id: string]: T[] } { +export function groupBy(key: (v) => any, input: Iterable): { [id: string]: T[] } { let groups = {}, iter = iterator(input), v: IteratorResult; diff --git a/packages/iterators/src/identity.ts b/packages/iterators/src/identity.ts index 9f0bc8867f..79137c560f 100644 --- a/packages/iterators/src/identity.ts +++ b/packages/iterators/src/identity.ts @@ -1,3 +1,3 @@ -export default function identity(x: T) { +export function identity(x: T) { return x; } diff --git a/packages/iterators/src/index.ts b/packages/iterators/src/index.ts index ba7962b302..d90a28b4ae 100644 --- a/packages/iterators/src/index.ts +++ b/packages/iterators/src/index.ts @@ -1,50 +1,50 @@ -export { default as butLast } from "./butlast"; -export { default as cached } from "./cached"; -export { default as concat } from "./concat"; -export { default as constantly } from "./constantly"; -export { default as consume } from "./consume"; -export { default as cycle } from "./cycle"; -export { default as dedupeWith } from "./dedupe-with"; -export { default as dedupe } from "./dedupe"; -export { default as dense } from "./dense"; -export { default as dropNth } from "./drop-nth"; -export { default as dropWhile } from "./drop-while"; -export { default as drop } from "./drop"; -export { ensureIterable, ensureIterator } from "./ensure"; -export { default as every } from "./every"; -export { default as filter } from "./filter"; -export { default as flattenWith } from "./flatten-with"; -export { default as flatten } from "./flatten"; -export { default as fnil } from "./fnil"; -export { default as fork } from "./fork"; -export { default as frequencies } from "./frequencies"; -export { default as groupBy } from "./group-by"; -export { default as identity } from "./identity"; -export { default as indexed } from "./indexed"; -export { default as interleave } from "./interleave"; -export { default as interpose } from "./interpose"; -export { default as iterate } from "./iterate"; -export { default as iterator, maybeIterator } from "./iterator"; -export { default as juxt } from "./juxt"; -export { default as last } from "./last"; -export { default as mapIndexed } from "./map-indexed"; -export { default as map } from "./map"; -export { default as mapcat } from "./mapcat"; -export { default as objectIterator, maybeObjectIterator } from "./object-iterator"; -export { default as partitionBy } from "./partition-by"; -export { default as partition } from "./partition"; -export { default as randomSample } from "./random-sample"; -export { default as range } from "./range"; -export { default as reduce, reduced, ReducedValue } from "./reduce"; -export { default as reductions } from "./reductions"; -export { default as repeat } from "./repeat"; -export { default as repeatedly } from "./repeatedly"; -export { default as reverse } from "./reverse"; -export { default as run } from "./run"; -export { default as some } from "./some"; -export { default as takeLast } from "./take-last"; -export { default as takeNth } from "./take-nth"; -export { default as takeWhile } from "./take-while"; -export { default as take } from "./take"; -export { default as walk, walkIterator } from "./walk"; -export { default as zip } from "./zip"; +export * from "./butlast"; +export * from "./cached"; +export * from "./concat"; +export * from "./constantly"; +export * from "./consume"; +export * from "./cycle"; +export * from "./dedupe-with"; +export * from "./dedupe"; +export * from "./dense"; +export * from "./drop-nth"; +export * from "./drop-while"; +export * from "./drop"; +export * from "./ensure"; +export * from "./every"; +export * from "./filter"; +export * from "./flatten-with"; +export * from "./flatten"; +export * from "./fnil"; +export * from "./fork"; +export * from "./frequencies"; +export * from "./group-by"; +export * from "./identity"; +export * from "./indexed"; +export * from "./interleave"; +export * from "./interpose"; +export * from "./iterate"; +export * from "./iterator"; +export * from "./juxt"; +export * from "./last"; +export * from "./map-indexed"; +export * from "./map"; +export * from "./mapcat"; +export * from "./object-iterator"; +export * from "./partition-by"; +export * from "./partition"; +export * from "./random-sample"; +export * from "./range"; +export * from "./reduce"; +export * from "./reductions"; +export * from "./repeat"; +export * from "./repeatedly"; +export * from "./reverse"; +export * from "./run"; +export * from "./some"; +export * from "./take-last"; +export * from "./take-nth"; +export * from "./take-while"; +export * from "./take"; +export * from "./walk"; +export * from "./zip"; diff --git a/packages/iterators/src/indexed.ts b/packages/iterators/src/indexed.ts index 1e78cd5204..0ee1b9c449 100644 --- a/packages/iterators/src/indexed.ts +++ b/packages/iterators/src/indexed.ts @@ -1,5 +1,5 @@ -import mapIndexed from "./map-indexed"; +import { mapIndexed } from "./map-indexed"; -export default function indexed(input: Iterable): IterableIterator<[number, T]> { +export function indexed(input: Iterable): IterableIterator<[number, T]> { return mapIndexed((i, x) => [i, x], input); } diff --git a/packages/iterators/src/interleave.ts b/packages/iterators/src/interleave.ts index fee25d0ebe..05367daf67 100644 --- a/packages/iterators/src/interleave.ts +++ b/packages/iterators/src/interleave.ts @@ -1,8 +1,8 @@ -import cycle from "./cycle"; -import map from "./map"; -import iterator from "./iterator"; +import { cycle } from "./cycle"; +import { map } from "./map"; +import { iterator } from "./iterator"; -export default function* interleave(...inputs: Iterable[]) { +export function* interleave(...inputs: Iterable[]) { let n = inputs.length; if (n === 0) { throw new Error(`no inputs given`); diff --git a/packages/iterators/src/interpose.ts b/packages/iterators/src/interpose.ts index 9007c11941..4fd63c9049 100644 --- a/packages/iterators/src/interpose.ts +++ b/packages/iterators/src/interpose.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* interpose(x: any, input: Iterable) { +export function* interpose(x: any, input: Iterable) { let iter = iterator(input), v: IteratorResult = iter.next(); while (!v.done) { diff --git a/packages/iterators/src/iterate.ts b/packages/iterators/src/iterate.ts index c0110ce576..b99e1eee29 100644 --- a/packages/iterators/src/iterate.ts +++ b/packages/iterators/src/iterate.ts @@ -1,4 +1,4 @@ -export default function* iterate(fn: (x: T) => T, seed: T) { +export function* iterate(fn: (x: T) => T, seed: T) { while (true) { yield seed; seed = fn(seed); diff --git a/packages/iterators/src/iterator.ts b/packages/iterators/src/iterator.ts index 955ad3d955..70d1f7b660 100644 --- a/packages/iterators/src/iterator.ts +++ b/packages/iterators/src/iterator.ts @@ -1,4 +1,4 @@ -export default function iterator(x: Iterable) { +export function iterator(x: Iterable) { return x[Symbol.iterator](); } diff --git a/packages/iterators/src/juxt.ts b/packages/iterators/src/juxt.ts index 45c4ac3001..3d29dcd95d 100644 --- a/packages/iterators/src/juxt.ts +++ b/packages/iterators/src/juxt.ts @@ -1,4 +1,4 @@ -export default function juxt(...fns: ((x: T) => any)[]) { +export function juxt(...fns: ((x: T) => any)[]) { return function (x: T) { let res = []; for (let i = 0; i < fns.length; i++) { diff --git a/packages/iterators/src/last.ts b/packages/iterators/src/last.ts index 8ad9d12516..6d9aedd1a9 100644 --- a/packages/iterators/src/last.ts +++ b/packages/iterators/src/last.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function last(input: Iterable) { +export function last(input: Iterable) { let iter = iterator(input), v: IteratorResult, prev: T; diff --git a/packages/iterators/src/map-indexed.ts b/packages/iterators/src/map-indexed.ts index e430a46163..38701ee3ab 100644 --- a/packages/iterators/src/map-indexed.ts +++ b/packages/iterators/src/map-indexed.ts @@ -1,6 +1,6 @@ -import map from "./map"; -import range from "./range"; +import { map } from "./map"; +import { range } from "./range"; -export default function mapIndexed(fn: (i: number, ...args: any[]) => T[], ...inputs: Iterable[]): IterableIterator { +export function mapIndexed(fn: (i: number, ...args: any[]) => T[], ...inputs: Iterable[]): IterableIterator { return map.apply(null, ([fn, range()] as any[]).concat(inputs)); } diff --git a/packages/iterators/src/map.ts b/packages/iterators/src/map.ts index 5613499f6d..67eea3a50c 100644 --- a/packages/iterators/src/map.ts +++ b/packages/iterators/src/map.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* map(fn: (...args: any[]) => T, ...inputs: Iterable[]) { +export function* map(fn: (...args: any[]) => T, ...inputs: Iterable[]) { let v: IteratorResult, n = inputs.length; switch (n) { diff --git a/packages/iterators/src/mapcat.ts b/packages/iterators/src/mapcat.ts index c462a8e34a..4acd14a120 100644 --- a/packages/iterators/src/mapcat.ts +++ b/packages/iterators/src/mapcat.ts @@ -1,7 +1,7 @@ -import map from "./map"; +import { map } from "./map"; import { ensureIterable } from "./ensure"; -export default function* mapcat(fn: (...args: any[]) => Iterable, ...inputs: Iterable[]): IterableIterator { +export function* mapcat(fn: (...args: any[]) => Iterable, ...inputs: Iterable[]): IterableIterator { (inputs as any[]).unshift(fn); let iter = map.apply(null, inputs), v: IteratorResult>; diff --git a/packages/iterators/src/object-iterator.ts b/packages/iterators/src/object-iterator.ts index 0672f169dd..631986dabf 100644 --- a/packages/iterators/src/object-iterator.ts +++ b/packages/iterators/src/object-iterator.ts @@ -1,6 +1,6 @@ -import map from "./map"; +import { map } from "./map"; -export default function objectIterator(x: any) { +export function objectIterator(x: any) { return map((k) => [k, x[k]], Object.keys(x)); } diff --git a/packages/iterators/src/partition-by.ts b/packages/iterators/src/partition-by.ts index 0e28e0ebdc..b5a8f00b2a 100644 --- a/packages/iterators/src/partition-by.ts +++ b/packages/iterators/src/partition-by.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* partitionBy(fn: (x: T) => any, input: Iterable) { +export function* partitionBy(fn: (x: T) => any, input: Iterable) { let iter = iterator(input), chunk: T[] = [], v: IteratorResult, diff --git a/packages/iterators/src/partition.ts b/packages/iterators/src/partition.ts index 2afbd86b39..4089ef6fe8 100644 --- a/packages/iterators/src/partition.ts +++ b/packages/iterators/src/partition.ts @@ -1,7 +1,7 @@ -import consume from "./consume"; -import iterator from "./iterator"; +import { consume } from "./consume"; +import { iterator } from "./iterator"; -export default function* partition(n: number, step: number, input: Iterable, all = false) { +export function* partition(n: number, step: number, input: Iterable, all = false) { if (n < 1) { throw new Error(`invalid partition size: ${n}`); } diff --git a/packages/iterators/src/random-sample.ts b/packages/iterators/src/random-sample.ts index ea890244a8..32dbfc5e93 100644 --- a/packages/iterators/src/random-sample.ts +++ b/packages/iterators/src/random-sample.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* randomSample(prob: number, input: Iterable) { +export function* randomSample(prob: number, input: Iterable) { let iter = iterator(input), random = Math.random, v: IteratorResult; diff --git a/packages/iterators/src/range.ts b/packages/iterators/src/range.ts index b80c03d8e2..89db57e105 100644 --- a/packages/iterators/src/range.ts +++ b/packages/iterators/src/range.ts @@ -1,8 +1,8 @@ -export default function range(): IterableIterator; -export default function range(to: number): IterableIterator; -export default function range(from: number, to: number): IterableIterator; -export default function range(from: number, to: number, step: number): IterableIterator; -export default function* range(from?: number, to?: number, step?: number) { +export function range(): IterableIterator; +export function range(to: number): IterableIterator; +export function range(from: number, to: number): IterableIterator; +export function range(from: number, to: number, step: number): IterableIterator; +export function* range(from?: number, to?: number, step?: number) { if (from === undefined) { from = 0; to = Number.POSITIVE_INFINITY; diff --git a/packages/iterators/src/reduce.ts b/packages/iterators/src/reduce.ts index d84e1b8139..36ed99fe5f 100644 --- a/packages/iterators/src/reduce.ts +++ b/packages/iterators/src/reduce.ts @@ -1,4 +1,4 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; export class ReducedValue { public value: T; @@ -8,7 +8,7 @@ export class ReducedValue { } } -export default function reduce(rfn: (acc: B, x: A) => B | ReducedValue, acc: B, input: Iterable) { +export function reduce(rfn: (acc: B, x: A) => B | ReducedValue, acc: B, input: Iterable) { let iter = iterator(input), v: IteratorResult, _acc: B | ReducedValue = acc; diff --git a/packages/iterators/src/reductions.ts b/packages/iterators/src/reductions.ts index e78208f24b..1572a4f147 100644 --- a/packages/iterators/src/reductions.ts +++ b/packages/iterators/src/reductions.ts @@ -1,7 +1,7 @@ import { ReducedValue } from "./reduce"; -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* reductions(rfn: (acc: B, x: A) => B | ReducedValue, acc: B, input: Iterable) { +export function* reductions(rfn: (acc: B, x: A) => B | ReducedValue, acc: B, input: Iterable) { let iter = iterator(input), v: IteratorResult, _acc: B | ReducedValue = acc, diff --git a/packages/iterators/src/repeat.ts b/packages/iterators/src/repeat.ts index f49ec312d3..cf4658e605 100644 --- a/packages/iterators/src/repeat.ts +++ b/packages/iterators/src/repeat.ts @@ -1,4 +1,4 @@ -export default function* repeat(x: T, n = Number.POSITIVE_INFINITY) { +export function* repeat(x: T, n = Number.POSITIVE_INFINITY) { while (n-- > 0) { yield x; } diff --git a/packages/iterators/src/repeatedly.ts b/packages/iterators/src/repeatedly.ts index 93b65e0243..8e4117609a 100644 --- a/packages/iterators/src/repeatedly.ts +++ b/packages/iterators/src/repeatedly.ts @@ -1,4 +1,4 @@ -export default function* repeatedly(fn: () => T, n = Number.POSITIVE_INFINITY) { +export function* repeatedly(fn: () => T, n = Number.POSITIVE_INFINITY) { while (n-- > 0) { yield fn(); } diff --git a/packages/iterators/src/reverse.ts b/packages/iterators/src/reverse.ts index b0dfd7983c..5e404ec93c 100644 --- a/packages/iterators/src/reverse.ts +++ b/packages/iterators/src/reverse.ts @@ -1,4 +1,4 @@ -export default function* reverse(input: Iterable) { +export function* reverse(input: Iterable) { if (!(input.constructor === Array || (input as T[]).length !== undefined)) { input = [...input]; } diff --git a/packages/iterators/src/run.ts b/packages/iterators/src/run.ts index 6bcd64720b..5f65f7cf8d 100644 --- a/packages/iterators/src/run.ts +++ b/packages/iterators/src/run.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function run(fn: (x: T) => any, input: Iterable) { +export function run(fn: (x: T) => any, input: Iterable) { let iter = iterator(input), v: IteratorResult; while (((v = iter.next()), !v.done)) { diff --git a/packages/iterators/src/some.ts b/packages/iterators/src/some.ts index ca04880bb9..bfeb5d3512 100644 --- a/packages/iterators/src/some.ts +++ b/packages/iterators/src/some.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function some(pred: (x: T) => boolean, input: Iterable) { +export function some(pred: (x: T) => boolean, input: Iterable) { let iter = iterator(input), v: IteratorResult; while (((v = iter.next()), !v.done)) { diff --git a/packages/iterators/src/take-last.ts b/packages/iterators/src/take-last.ts index e8e6708d70..601fee917d 100644 --- a/packages/iterators/src/take-last.ts +++ b/packages/iterators/src/take-last.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* takeLast(n: number, input: Iterable) { +export function* takeLast(n: number, input: Iterable) { let iter = iterator(input), v: IteratorResult, prev: T[] = []; diff --git a/packages/iterators/src/take-nth.ts b/packages/iterators/src/take-nth.ts index ba4133dad9..ac0dd3377f 100644 --- a/packages/iterators/src/take-nth.ts +++ b/packages/iterators/src/take-nth.ts @@ -1,7 +1,7 @@ -import consume from "./consume"; -import iterator from "./iterator"; +import { consume } from "./consume"; +import { iterator } from "./iterator"; -export default function* takeNth(n: number, input: Iterable) { +export function* takeNth(n: number, input: Iterable) { let iter = iterator(input), v: IteratorResult; while (((v = iter.next()), !v.done)) { diff --git a/packages/iterators/src/take-while.ts b/packages/iterators/src/take-while.ts index e451d1cc9d..aa9d9d7f82 100644 --- a/packages/iterators/src/take-while.ts +++ b/packages/iterators/src/take-while.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* takeWhile(pred: (x: T) => boolean, input: Iterable) { +export function* takeWhile(pred: (x: T) => boolean, input: Iterable) { let iter = iterator(input), v: IteratorResult; while (((v = iter.next()), !v.done && pred(v.value))) { diff --git a/packages/iterators/src/take.ts b/packages/iterators/src/take.ts index fdc6d79f7c..1674b1109c 100644 --- a/packages/iterators/src/take.ts +++ b/packages/iterators/src/take.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function* take(n: number, input: Iterable) { +export function* take(n: number, input: Iterable) { let iter = iterator(input); while (n-- > 0) { let v = iter.next(); diff --git a/packages/iterators/src/walk.ts b/packages/iterators/src/walk.ts index c802d80cce..02e48fa16c 100644 --- a/packages/iterators/src/walk.ts +++ b/packages/iterators/src/walk.ts @@ -1,11 +1,11 @@ -import { default as iterator, maybeIterator } from "./iterator"; +import { iterator, maybeIterator } from "./iterator"; import { maybeObjectIterator } from "./object-iterator"; export function walkable(x) { return typeof x !== "string" ? maybeIterator(x) || maybeObjectIterator(x) : undefined; } -export default function walk(fn: (x: any) => void, input: Iterable, postOrder = false) { +export function walk(fn: (x: any) => void, input: Iterable, postOrder = false) { let inner = (iter) => { let v: IteratorResult, node; diff --git a/packages/iterators/src/zip.ts b/packages/iterators/src/zip.ts index 1046a55293..b8cba4b4d4 100644 --- a/packages/iterators/src/zip.ts +++ b/packages/iterators/src/zip.ts @@ -1,6 +1,6 @@ -import iterator from "./iterator"; +import { iterator } from "./iterator"; -export default function zip(keys: Iterable, vals: Iterable, target?: any) { +export function zip(keys: Iterable, vals: Iterable, target?: any) { let kiter = iterator(keys), viter = iterator(vals), k: IteratorResult, diff --git a/packages/iterators/test/index.ts b/packages/iterators/test/index.ts index 0cbacdead3..6339a2afc8 100644 --- a/packages/iterators/test/index.ts +++ b/packages/iterators/test/index.ts @@ -73,8 +73,8 @@ describe("iterators", function () { assert.deepEqual([...ti.dropNth(-1, ti.range(6))], [], "dropNth(-1)"); }); it("dropWhile", () => { - assert.deepEqual([...ti.dropWhile((x) => false, [])], [], "empty"); - assert.deepEqual([...ti.dropWhile((x) => true, [1, 2, 3])], [], "always"); + assert.deepEqual([...ti.dropWhile((_) => false, [])], [], "empty"); + assert.deepEqual([...ti.dropWhile((_) => true, [1, 2, 3])], [], "always"); assert.deepEqual([...ti.dropWhile((x) => x < 3, ti.range(6))], [3, 4, 5], "x<3"); assert.deepEqual([...ti.dropWhile((x) => x > 3, ti.range(6))], [0, 1, 2, 3, 4, 5], "none"); }); @@ -84,7 +84,7 @@ describe("iterators", function () { }); it("every", () => { let nums = ti.iterator([2, 4, 6, 8, 10]) as IterableIterator; - assert(!ti.every((x) => true, []), "empty"); + assert(!ti.every((_) => true, []), "empty"); assert(ti.every((x) => (x % 2) === 0, nums), "even"); assert.deepEqual(nums.next(), { value: undefined, done: true }, "nums done"); nums = ti.iterator([2, 3, 4]) as IterableIterator; @@ -92,7 +92,7 @@ describe("iterators", function () { assert.deepEqual(nums.next(), { value: 4, done: false }, "next = 4"); }); it("filter", () => { - assert.deepEqual([...ti.filter((x) => true, [])], [], "empty"); + assert.deepEqual([...ti.filter((_) => true, [])], [], "empty"); assert.deepEqual([...ti.filter((x) => (x % 3) === 0, ti.range(10))], [0, 3, 6, 9], "mult3"); }); it("flatten", () => { @@ -266,7 +266,7 @@ describe("iterators", function () { }); it("takeWhile", () => { let input = ti.range(10); - assert.deepEqual([...ti.takeWhile((x) => true, [])], [], "empty"); + assert.deepEqual([...ti.takeWhile((_) => true, [])], [], "empty"); assert.deepEqual([...ti.takeWhile((x) => x < 5, input)], [0, 1, 2, 3, 4], "x<5"); assert.deepEqual([...input], [6, 7, 8, 9], "rest"); }); diff --git a/packages/iterators/test/tsconfig.json b/packages/iterators/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/iterators/test/tsconfig.json +++ b/packages/iterators/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/iterators/tsconfig.json b/packages/iterators/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/iterators/tsconfig.json +++ b/packages/iterators/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/rle-pack/CHANGELOG.md b/packages/rle-pack/CHANGELOG.md index b99062b5b6..0ffa817115 100644 --- a/packages/rle-pack/CHANGELOG.md +++ b/packages/rle-pack/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/rle-pack@0.2.3...@thi.ng/rle-pack@0.2.4) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rle-pack + ## [0.2.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@0.2.2...@thi.ng/rle-pack@0.2.3) (2018-01-28) diff --git a/packages/rle-pack/package.json b/packages/rle-pack/package.json index 41d7f4073a..76f30b81a0 100644 --- a/packages/rle-pack/package.json +++ b/packages/rle-pack/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rle-pack", - "version": "0.2.3", + "version": "0.2.4", "description": "Binary run-length encoding packer w/ flexible repeat bit widths", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -24,7 +25,7 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/bitstream": "^0.3.2" + "@thi.ng/bitstream": "^0.3.3" }, "keywords": [ "ES6", diff --git a/packages/rle-pack/test/index.ts b/packages/rle-pack/test/index.ts new file mode 100644 index 0000000000..e9cda36d84 --- /dev/null +++ b/packages/rle-pack/test/index.ts @@ -0,0 +1,3 @@ +describe("rle-pack", () => { + it("tests pending"); +}); diff --git a/packages/rle-pack/test/tsconfig.json b/packages/rle-pack/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/rle-pack/test/tsconfig.json +++ b/packages/rle-pack/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/rle-pack/tsconfig.json b/packages/rle-pack/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/rle-pack/tsconfig.json +++ b/packages/rle-pack/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/rstream-csp/CHANGELOG.md b/packages/rstream-csp/CHANGELOG.md index b6aeda08a4..8952d98839 100644 --- a/packages/rstream-csp/CHANGELOG.md +++ b/packages/rstream-csp/CHANGELOG.md @@ -3,6 +3,54 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.5...@thi.ng/rstream-csp@0.1.6) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + + +## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.4...@thi.ng/rstream-csp@0.1.5) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + + +## [0.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.3...@thi.ng/rstream-csp@0.1.4) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + + +## [0.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.2...@thi.ng/rstream-csp@0.1.3) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + + +## [0.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.1...@thi.ng/rstream-csp@0.1.2) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + + +## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.0...@thi.ng/rstream-csp@0.1.1) (2018-01-28) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + # 0.1.0 (2018-01-28) diff --git a/packages/rstream-csp/LICENSE b/packages/rstream-csp/LICENSE new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/packages/rstream-csp/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/rstream-csp/README.md b/packages/rstream-csp/README.md index 37bd64e6b2..66c688957a 100644 --- a/packages/rstream-csp/README.md +++ b/packages/rstream-csp/README.md @@ -19,6 +19,7 @@ yarn add @thi.ng/rstream-csp ```typescript import * as rs from "@thi.ng/rstream"; +import * as tx from "@thi.ng/transducers"; import { fromChannel } from "@thi.ng/rstream-csp"; import { Channel } from "@thi.ng/csp"; @@ -42,8 +43,8 @@ stream.subscribe(rs.trace("tentimes"), tx.map(x => x * 10)); ## Authors -- Karsten Schmidt +- Karsten Schmidt ## License -© 2018 Karsten Schmidt // Apache Software License 2.0 +© 2018 Karsten Schmidt // Apache Software License 2.0 diff --git a/packages/rstream-csp/package.json b/packages/rstream-csp/package.json index 3922d51843..7660648522 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.0", + "version": "0.1.6", "description": "TODO", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", - "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "build": "yarn clean && tsc --declaration", + "clean": "rm -rf *.js *.d.ts build doc from", + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -23,8 +24,8 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/api": "^1.3.0", - "@thi.ng/rstream": "^0.6.0" + "@thi.ng/api": "^1.4.1", + "@thi.ng/rstream": "^0.7.4" }, "keywords": [ "bridge", diff --git a/packages/rstream-csp/test/tsconfig.json b/packages/rstream-csp/test/tsconfig.json index 84337fa2b7..13d45669e5 100644 --- a/packages/rstream-csp/test/tsconfig.json +++ b/packages/rstream-csp/test/tsconfig.json @@ -1,10 +1,10 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", "../src/**/*.ts" ] -} +} \ No newline at end of file diff --git a/packages/rstream-csp/tsconfig.json b/packages/rstream-csp/tsconfig.json index ca7ff0a236..f6c291a0a0 100644 --- a/packages/rstream-csp/tsconfig.json +++ b/packages/rstream-csp/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] -} +} \ No newline at end of file diff --git a/packages/rstream-log/CHANGELOG.md b/packages/rstream-log/CHANGELOG.md index 4102917e04..1ffd9abecd 100644 --- a/packages/rstream-log/CHANGELOG.md +++ b/packages/rstream-log/CHANGELOG.md @@ -3,6 +3,46 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@0.5.6...@thi.ng/rstream-log@0.5.7) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-log + + +## [0.5.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@0.5.5...@thi.ng/rstream-log@0.5.6) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-log + + +## [0.5.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@0.5.4...@thi.ng/rstream-log@0.5.5) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-log + + +## [0.5.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@0.5.3...@thi.ng/rstream-log@0.5.4) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-log + + +## [0.5.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@0.5.2...@thi.ng/rstream-log@0.5.3) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream-log + ## [0.5.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@0.5.1...@thi.ng/rstream-log@0.5.2) (2018-01-28) diff --git a/packages/rstream-log/package.json b/packages/rstream-log/package.json index 2324854ec1..cd9fa9ddfa 100644 --- a/packages/rstream-log/package.json +++ b/packages/rstream-log/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-log", - "version": "0.5.2", + "version": "0.5.7", "description": "TODO", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc output transform", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -23,8 +24,8 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/rstream": "^0.6.0", - "@thi.ng/transducers": "^1.0.0" + "@thi.ng/rstream": "^0.7.4", + "@thi.ng/transducers": "^1.0.3" }, "keywords": [ "ES6", diff --git a/packages/rstream-log/test/index.ts b/packages/rstream-log/test/index.ts new file mode 100644 index 0000000000..2298cab63d --- /dev/null +++ b/packages/rstream-log/test/index.ts @@ -0,0 +1,3 @@ +describe("rstream-log", () => { + it("tests pending"); +}); diff --git a/packages/rstream-log/test/tsconfig.json b/packages/rstream-log/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/rstream-log/test/tsconfig.json +++ b/packages/rstream-log/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/rstream-log/tsconfig.json b/packages/rstream-log/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/rstream-log/tsconfig.json +++ b/packages/rstream-log/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/rstream/CHANGELOG.md b/packages/rstream/CHANGELOG.md index b352edf256..d88fe73109 100644 --- a/packages/rstream/CHANGELOG.md +++ b/packages/rstream/CHANGELOG.md @@ -3,6 +3,57 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.7.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@0.7.3...@thi.ng/rstream@0.7.4) (2018-01-29) + + +### Bug Fixes + +* **rstream:** fatal recursion w/ error handling ([382aa05](https://github.com/thi-ng/umbrella/commit/382aa05)) + + + + + +## [0.7.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@0.7.2...@thi.ng/rstream@0.7.3) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream + + +## [0.7.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@0.7.1...@thi.ng/rstream@0.7.2) (2018-01-29) + + +### Bug Fixes + +* **rstream:** fix [#1](https://github.com/thi-ng/umbrella/issues/1) update fromPromise(), add test ([822b297](https://github.com/thi-ng/umbrella/commit/822b297)) + + + + + +## [0.7.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@0.7.0...@thi.ng/rstream@0.7.1) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/rstream + + +# [0.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@0.6.0...@thi.ng/rstream@0.7.0) (2018-01-29) + + +### Features + +* **rstream:** add atom dep, add fromAtom() & docs ([ca3994a](https://github.com/thi-ng/umbrella/commit/ca3994a)) +* **rstream:** add fromPromises(), add docs ([55ba0e1](https://github.com/thi-ng/umbrella/commit/55ba0e1)) +* **rstream:** add trace() error handler ([2247f72](https://github.com/thi-ng/umbrella/commit/2247f72)) + + + + # [0.6.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@0.5.1...@thi.ng/rstream@0.6.0) (2018-01-28) diff --git a/packages/rstream/package.json b/packages/rstream/package.json index 35c6fb7350..8225456c17 100644 --- a/packages/rstream/package.json +++ b/packages/rstream/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream", - "version": "0.6.0", + "version": "0.7.4", "description": "Reactive multi-tap streams & transformation pipeline constructs", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc from subs utils", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -23,8 +24,9 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/api": "^1.3.0", - "@thi.ng/transducers": "^1.0.0" + "@thi.ng/api": "^1.4.1", + "@thi.ng/atom": "^0.2.1", + "@thi.ng/transducers": "^1.0.3" }, "keywords": [ "ES6", diff --git a/packages/rstream/src/from/atom.ts b/packages/rstream/src/from/atom.ts new file mode 100644 index 0000000000..515881352d --- /dev/null +++ b/packages/rstream/src/from/atom.ts @@ -0,0 +1,38 @@ +import { ReadonlyAtom } from "@thi.ng/atom/api"; +import { Stream } from "../stream"; + +/** + * Yields stream of value changes in given atom / cursor. + * Attaches watch to atom and compares values with `===`. + * If `emitFirst` is true (default), also emits atom's + * current value when first subscriber attaches to stream. + * + * See: @thi.ng/atom + * + * ``` + * db = new Atom({a: 23, b: 88}); + * cursor = new Cursor(db, (s) => s.a, (s, x)=> ({...s, a: x})) + * + * rs.fromAtom(cursor).subscribe(rs.trace("cursor val:")) + * // cursor val: 23 + * + * cursor.reset(42); + * // cursor val: 42 + * + * db.reset({a: 66}) + * // cursor val: 66 + * ``` + * + * @param atom + */ +export function fromAtom(atom: ReadonlyAtom, emitFirst = true): Stream { + return new Stream((stream) => { + atom.addWatch(stream.id, (_, prev, curr) => { + if (curr !== prev) { + stream.next(curr); + } + }); + emitFirst && stream.next(atom.deref()); + return () => atom.removeWatch(stream.id); + }); +} diff --git a/packages/rstream/src/from/promise.ts b/packages/rstream/src/from/promise.ts index 429cc06279..5d7098fcae 100644 --- a/packages/rstream/src/from/promise.ts +++ b/packages/rstream/src/from/promise.ts @@ -1,14 +1,34 @@ import { State } from "../api"; import { Stream } from "../stream"; +/** + * Yields a single-value stream of the resolved promise and then + * automatically marks itself done. It doesn't matter if the promise + * resolves before the first subscriber has attached. + * + * @param src + */ export function fromPromise(src: Promise) { - let canceled = false; + let canceled = false, + isError = false, + err: any = {}; + src.catch( + (e) => { + err = e; + isError = true; + } + ); return new Stream((stream) => { src.then( (x) => { if (!canceled && stream.getState() < State.DONE) { - stream.next(x); - stream.done(); + if (isError) { + stream.error(err); + err = null; + } else { + stream.next(x); + stream.done(); + } } }, (e) => stream.error(e) diff --git a/packages/rstream/src/from/promises.ts b/packages/rstream/src/from/promises.ts new file mode 100644 index 0000000000..243d5332b4 --- /dev/null +++ b/packages/rstream/src/from/promises.ts @@ -0,0 +1,38 @@ +import { mapcat } from "@thi.ng/transducers/xform/mapcat"; + +import { Subscription } from "../subscription"; +import { fromPromise } from "./promise"; + +/** + * Wraps given promises in `Promise.all()` to yield stream of results in + * same order as arguments, then closes. If any of the promises rejects, + * all others do too and calls `error()` in subscribers. + * + * ``` + * rs.fromPromises([ + * Promise.resolve(1), + * Promise.resolve(2), + * Promise.resolve(3) + * ]).subscribe(rs.trace()) + * // 1 + * // 2 + * // 3 + * // done + * ``` + * + * If individual error handling is required, an alternative is below + * (however this approach provides no ordering guarantees): + * + * ``` + * rs.fromIterable([ + * Promise.resolve(1), + * new Promise(()=> { setTimeout(()=> { throw new Error("eeek"); }, 10); }), + * Promise.resolve(3) + * ]).subscribe(rs.resolve()).subscribe(rs.trace()) + * ``` + * + * @param promises + */ +export function fromPromises(promises: Iterable>): Subscription { + return fromPromise(Promise.all(promises)).subscribe(mapcat((x: T[]) => x)); +} diff --git a/packages/rstream/src/index.ts b/packages/rstream/src/index.ts index cf2d74e1f6..6f9176cdf2 100644 --- a/packages/rstream/src/index.ts +++ b/packages/rstream/src/index.ts @@ -3,10 +3,12 @@ export * from "./stream"; export * from "./stream-merge"; export * from "./subscription"; +export * from "./from/atom"; export * from "./from/event"; export * from "./from/interval"; export * from "./from/iterable"; export * from "./from/promise"; +export * from "./from/promises"; export * from "./from/raf"; export * from "./from/worker"; diff --git a/packages/rstream/src/subs/trace.ts b/packages/rstream/src/subs/trace.ts index ccb1b61b08..76f0d68920 100644 --- a/packages/rstream/src/subs/trace.ts +++ b/packages/rstream/src/subs/trace.ts @@ -7,6 +7,9 @@ export function trace(prefix?: any): ISubscriber { }, done() { prefix ? console.log(prefix, "done") : console.log("done"); + }, + error(e) { + prefix ? console.log(prefix, "error", e) : console.log("error", e); } } } diff --git a/packages/rstream/src/subscription.ts b/packages/rstream/src/subscription.ts index 60065dddd5..d93fd315a1 100644 --- a/packages/rstream/src/subscription.ts +++ b/packages/rstream/src/subscription.ts @@ -125,7 +125,9 @@ export class Subscription implements } } this.state = State.DONE; - this.dispatch(undefined, "done", [...this.subs]); + for (let s of [...this.subs]) { + s.done && s.done(); + } this.parent && this.parent.unsubscribe(this); delete this.parent; delete this.subs; @@ -137,7 +139,9 @@ export class Subscription implements error(e: any) { this.state = State.ERROR; if (this.subs && this.subs.length) { - this.dispatch(e, "error"); + for (let s of [...this.subs]) { + s.error && s.error(e); + } } else { console.log(this.id, "unhandled error:", e); if (this.parent) { @@ -153,11 +157,12 @@ export class Subscription implements return wrapped; } - protected dispatch(x: B, op = "next", subs = this.subs) { + protected dispatch(x: B) { + let subs = this.subs; for (let i = 0, n = subs.length; i < n; i++) { const s = subs[i]; try { - s[op] && s[op](x); + s.next && s.next(x); } catch (e) { s.error ? s.error(e) : this.error(e); } diff --git a/packages/rstream/test/from-promise.ts b/packages/rstream/test/from-promise.ts index 66acb4e4dd..2470c36b9e 100644 --- a/packages/rstream/test/from-promise.ts +++ b/packages/rstream/test/from-promise.ts @@ -13,7 +13,7 @@ describe("fromPromise()", () => { called = true; }, done() { - assert(called, "not called"); + assert(called, "not called next()"); done(); } }); @@ -22,64 +22,50 @@ describe("fromPromise()", () => { it("rejects to sub", (done) => { let src = rs.fromPromise(Promise.reject(23)), called = false, - calledDone = false, sub = src.subscribe({ + next(_) { + assert.fail("called next()"); + }, + done() { + assert.fail("called done()"); + }, error(x) { assert.equal(x, 23); assert.equal(src.getState(), rs.State.ERROR); assert.equal(sub.getState(), rs.State.ERROR); called = true; - }, - done() { - calledDone = true; } }); setTimeout(() => { assert(called, "not called"); - assert(!calledDone, "called done"); done(); - }, 10); + }, 1); }); it("passes error to sub", (done) => { let src = rs.fromPromise(new Promise(() => { throw new Error("foo"); })), called = false, - calledDone = false, sub = src.subscribe({ + next(_) { + assert.fail("called next()"); + }, + done() { + assert.fail("called done()"); + }, error(x) { assert.equal(x.message, "foo"); assert.equal(src.getState(), rs.State.ERROR); assert.equal(sub.getState(), rs.State.ERROR); called = true; - }, - done() { - calledDone = true; } }); setTimeout(() => { assert(called, "not called"); - assert(!calledDone, "called done"); - done(); - }, 10); - }); - - it("goes into ERROR state", (done) => { - let src = rs.fromPromise(new Promise(() => { throw new Error("foo"); })), - calledDone = false, - sub = src.subscribe({ - done() { - calledDone = true; - } - }); - setTimeout(() => { - assert.equal(src.getState(), rs.State.ERROR, "src not ERROR"); - assert.equal(sub.getState(), rs.State.ERROR, "sub not ERROR"); - assert(!calledDone, "called done"); assert.throws(() => src.next(Promise.resolve()), "no next() allowed"); src.done(); assert.equal(src.getState(), rs.State.ERROR, "src not ERROR"); done(); - }, 0); + }, 10); }); it("resolves via Resolver", (done) => { @@ -97,5 +83,4 @@ describe("fromPromise()", () => { } }); }); - }); diff --git a/packages/rstream/test/sidechain-partition.ts b/packages/rstream/test/sidechain-partition.ts index 4ba00a9502..b1c1eef16a 100644 --- a/packages/rstream/test/sidechain-partition.ts +++ b/packages/rstream/test/sidechain-partition.ts @@ -2,7 +2,7 @@ import * as assert from "assert"; import * as rs from "../src/index"; -describe("SidechainPartition", () => { +describe("SidechainPartition", function () { it("partitions (manual)", (done) => { let src = new rs.Stream(); @@ -29,34 +29,6 @@ describe("SidechainPartition", () => { side.done(); }); - it("partitions (interval)", (done) => { - let src = rs.fromInterval(10); - let side = rs.fromInterval(27); - let buf = []; - src.subscribe(rs.sidechainPartition(side)) - .subscribe({ - next(x) { - buf.push(x); - }, - done() { - try { - assert.deepEqual( - buf, - [[0, 1], [2, 3, 4], [5, 6]] - ); - } catch (_) { - // possible alternative due to timing issues - assert.deepEqual( - buf, - [[0, 1], [2, 3], [4, 5, 6]] - ); - } - done(); - } - }); - setTimeout(() => src.done(), 100); - }); - it("partitions w/ predicate", (done) => { let src = new rs.Stream(); let side = new rs.Stream(); diff --git a/packages/rstream/test/tsconfig.json b/packages/rstream/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/rstream/test/tsconfig.json +++ b/packages/rstream/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/rstream/tsconfig.json b/packages/rstream/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/rstream/tsconfig.json +++ b/packages/rstream/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/transducers/CHANGELOG.md b/packages/transducers/CHANGELOG.md index c5ab2b872f..513efdeea7 100644 --- a/packages/transducers/CHANGELOG.md +++ b/packages/transducers/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. + +## [1.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.0.2...@thi.ng/transducers@1.0.3) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/transducers + + +## [1.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.0.1...@thi.ng/transducers@1.0.2) (2018-01-29) + + +### Performance Improvements + +* **transducers:** avoid result object cloning in struct() xform ([d774e32](https://github.com/thi-ng/umbrella/commit/d774e32)) + + + + + +## [1.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.0.0...@thi.ng/transducers@1.0.1) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/transducers + # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@0.11.2...@thi.ng/transducers@1.0.0) (2018-01-28) diff --git a/packages/transducers/package.json b/packages/transducers/package.json index f3a00d746f..3b485da1ce 100644 --- a/packages/transducers/package.json +++ b/packages/transducers/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/transducers", - "version": "1.0.0", + "version": "1.0.3", "description": "Lightweight transducer implementations for ES6 / TypeScript", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc func iter rfn xform", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -23,7 +24,7 @@ "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/api": "^1.3.0" + "@thi.ng/api": "^1.4.1" }, "keywords": [ "ES6", diff --git a/packages/transducers/src/xform/pad-last.ts b/packages/transducers/src/xform/pad-last.ts index 07e8b04f48..2c76f5c0eb 100644 --- a/packages/transducers/src/xform/pad-last.ts +++ b/packages/transducers/src/xform/pad-last.ts @@ -6,14 +6,18 @@ import { isReduced } from "../reduced"; * of `n`. Only makes sense for finite streams / reductions. Does nothing * if the to be transformed data source has exactly multiple of `n` * values, but if not pads / supplies additional `fill` values at the end - * until the next multiple is reached. + * until the next multiple is reached. No padding takes place if input + * is empty, since length 0 is always a multiple. * * ``` * [...iterator(padLast(8, 0), [1, 2, 3, 4, 5])] * // [ 1, 2, 3, 4, 5, 0, 0, 0 ] * * [...iterator(padLast(8, 0), [1])] - * // [ 0, 0, 0, 0, 0, 0, 0, 0 ] + * // [ 1, 0, 0, 0, 0, 0, 0, 0 ] + * + * [...iterator(padLast(8, 0), [])] + * // [] * * [...iterator(padLast(2, 0), [1, 2, 3])] * // [ 1, 2, 3, 0 ] diff --git a/packages/transducers/src/xform/struct.ts b/packages/transducers/src/xform/struct.ts index 47be93589b..289afdfbdf 100644 --- a/packages/transducers/src/xform/struct.ts +++ b/packages/transducers/src/xform/struct.ts @@ -35,6 +35,6 @@ export function struct(fields: StructField[]): Transducer { partitionOf(fields.map((f) => f[1])), partition(fields.length), rename(fields.reduce((acc, f, i) => (acc[f[0]] = i, acc), {})), - mapKeys(fields.reduce((acc, f) => (f[2] ? (acc[f[0]] = f[2], acc) : acc), {})) + mapKeys(fields.reduce((acc, f) => (f[2] ? (acc[f[0]] = f[2], acc) : acc), {}), false) ); } diff --git a/packages/transducers/test/index.ts b/packages/transducers/test/index.ts new file mode 100644 index 0000000000..cae94878a0 --- /dev/null +++ b/packages/transducers/test/index.ts @@ -0,0 +1,3 @@ +describe("transducers", () => { + it("tests pending"); +}); diff --git a/packages/transducers/test/tsconfig.json b/packages/transducers/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/transducers/test/tsconfig.json +++ b/packages/transducers/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/transducers/tsconfig.json b/packages/transducers/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/transducers/tsconfig.json +++ b/packages/transducers/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/packages/unionstruct/CHANGELOG.md b/packages/unionstruct/CHANGELOG.md index 16f59cdc30..b46649cdba 100644 --- a/packages/unionstruct/CHANGELOG.md +++ b/packages/unionstruct/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.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/unionstruct@0.1.2...@thi.ng/unionstruct@0.1.3) (2018-01-29) + + + + +**Note:** Version bump only for package @thi.ng/unionstruct + ## [0.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/unionstruct@0.1.1...@thi.ng/unionstruct@0.1.2) (2018-01-28) diff --git a/packages/unionstruct/package.json b/packages/unionstruct/package.json index 50a892fdf5..8fb22d9945 100644 --- a/packages/unionstruct/package.json +++ b/packages/unionstruct/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/unionstruct", - "version": "0.1.2", + "version": "0.1.3", "description": "C-style struct, union and bitfield views of ArrayBuffers", "main": "./index.js", "typings": "./index.d.ts", @@ -8,10 +8,11 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", + "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", diff --git a/packages/unionstruct/test/tsconfig.json b/packages/unionstruct/test/tsconfig.json index 15f6b2a4f3..13d45669e5 100644 --- a/packages/unionstruct/test/tsconfig.json +++ b/packages/unionstruct/test/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/packages/unionstruct/tsconfig.json b/packages/unionstruct/tsconfig.json index fe4ca75067..f6c291a0a0 100644 --- a/packages/unionstruct/tsconfig.json +++ b/packages/unionstruct/tsconfig.json @@ -4,6 +4,6 @@ "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } \ No newline at end of file diff --git a/scripts/make-module b/scripts/make-module index fa4eb6fc4b..a9ae76c8be 100755 --- a/scripts/make-module +++ b/scripts/make-module @@ -1,7 +1,8 @@ #!/bin/sh readonly MODULE="packages/$1" -readonly AUTHOR="Karsten Schmidt " +readonly AUTHOR="Karsten Schmidt" +readonly EMAIL="k+npm@thi.ng" echo "generating module: $MODULE" mkdir -p $MODULE @@ -10,6 +11,8 @@ echo "creating /src & /test folders..." mkdir -p $MODULE/src $MODULE/test touch $MODULE/src/index.ts +cp packages/api/LICENSE $MODULE/ + echo "writing test skeleton..." cat << EOF > $MODULE/test/index.ts import * as assert from "assert"; @@ -31,13 +34,14 @@ cat << EOF > $MODULE/package.json "main": "./index.js", "typings": "./index.d.ts", "repository": "https://github.com/thi-ng/umbrella", - "author": "$AUTHOR", + "author": "$AUTHOR <$EMAIL>", "license": "Apache-2.0", "scripts": { "build": "yarn run clean && tsc --declaration", - "test": "yarn run clean && tsc -p test && mocha build/test/*.js", "clean": "rm -rf *.js *.d.ts build doc", - "pub": "yarn run build && yarn publish --access public" + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn run build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && mocha build/test/*.js" }, "devDependencies": { "@types/mocha": "^2.2.46", @@ -49,7 +53,7 @@ cat << EOF > $MODULE/package.json "webpack": "^3.10.0" }, "dependencies": { - "@thi.ng/api": "^1.2.1" + "@thi.ng/api": "^1.5.0" }, "keywords": [ "ES6", @@ -69,7 +73,7 @@ cat << EOF > $MODULE/tsconfig.json "outDir": "." }, "include": [ - "./src/**/*.ts", + "./src/**/*.ts" ] } EOF @@ -79,7 +83,7 @@ cat << EOF > $MODULE/test/tsconfig.json { "extends": "../../../tsconfig.json", "compilerOptions": { - "outDir": "../build", + "outDir": "../build" }, "include": [ "./**/*.ts", diff --git a/yarn.lock b/yarn.lock index 561fd1ae86..3457bef3d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -115,6 +115,10 @@ ansi-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + ansi-styles@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" @@ -139,6 +143,12 @@ are-we-there-yet@~1.1.2: delegates "^1.0.0" readable-stream "^2.0.6" +argparse@^1.0.7: + version "1.0.9" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + dependencies: + sprintf-js "~1.0.2" + arr-diff@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" @@ -243,6 +253,14 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" +babel-code-frame@^6.22.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" @@ -403,7 +421,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -builtin-modules@^1.0.0: +builtin-modules@^1.0.0, builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -463,6 +481,16 @@ center-align@^0.1.1: align-text "^0.1.3" lazy-cache "^1.0.3" +chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" @@ -593,6 +621,10 @@ commander@2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" +commander@^2.12.1: + version "2.13.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" + compare-func@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-1.3.2.tgz#99dd0ba457e1f9bc722b12c08ec33eeab31fa648" @@ -954,6 +986,10 @@ diff@3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" +diff@^3.2.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c" + diffie-hellman@^5.0.0: version "5.0.2" resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.2.tgz#b5835739270cfe26acf632099fded2a07f209e5e" @@ -1075,7 +1111,7 @@ es6-weak-map@^2.0.1: es6-iterator "^2.0.1" es6-symbol "^3.1.1" -escape-string-regexp@1.0.5, escape-string-regexp@^1.0.5: +escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1088,6 +1124,10 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" +esprima@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" + esrecurse@^4.1.0: version "4.2.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" @@ -1099,6 +1139,10 @@ estraverse@^4.1.0, estraverse@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" +esutils@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" + event-emitter@~0.3.5: version "0.3.5" resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" @@ -1430,7 +1474,7 @@ glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: +glob@7.1.2, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -1496,6 +1540,12 @@ har-validator@~4.2.1: ajv "^4.9.1" har-schema "^1.0.5" +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + dependencies: + ansi-regex "^2.0.0" + has-flag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" @@ -1882,6 +1932,17 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + +js-yaml@^3.7.0: + version "3.10.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" @@ -2899,7 +2960,7 @@ resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" -resolve@^1.1.6: +resolve@^1.1.6, resolve@^1.3.2: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: @@ -3127,6 +3188,10 @@ split@^1.0.0: dependencies: through "2" +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + sshpk@^1.7.0: version "1.13.1" resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.13.1.tgz#512df6da6287144316dc4c18fe1cf1d940739be3" @@ -3242,6 +3307,10 @@ supports-color@4.4.0: dependencies: has-flag "^2.0.0" +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + supports-color@^4.0.0, supports-color@^4.2.1: version "4.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" @@ -3375,6 +3444,33 @@ ts-loader@^3.3.1: micromatch "^3.1.4" semver "^5.0.1" +tslib@^1.8.0, tslib@^1.8.1: + version "1.9.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" + +tslint@^5.9.1: + version "5.9.1" + resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.9.1.tgz#1255f87a3ff57eb0b0e1f0e610a8b4748046c9ae" + dependencies: + babel-code-frame "^6.22.0" + builtin-modules "^1.1.1" + chalk "^2.3.0" + commander "^2.12.1" + diff "^3.2.0" + glob "^7.1.1" + js-yaml "^3.7.0" + minimatch "^3.0.4" + resolve "^1.3.2" + semver "^5.3.0" + tslib "^1.8.0" + tsutils "^2.12.1" + +tsutils@^2.12.1: + version "2.19.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.19.1.tgz#76d7ebdea9d7a7bf4a05f50ead3701b0168708d7" + dependencies: + tslib "^1.8.1" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"