Compare commits

...

6 Commits
dev ... master

Author SHA1 Message Date
Lewis Diamond
e005b45207 set repo to github 2021-02-05 20:13:45 -05:00
Lewis Diamond
2fb7942d9c Update package to use itself in dev, update samples 2020-08-05 19:08:13 -04:00
Lewis Diamond
fc5b96f725 Merge branch 'dev' into master 2020-08-05 10:42:33 -04:00
Lewis Diamond
491ec146a6 Update readme 2020-08-05 10:41:23 -04:00
Lewis Diamond
38bb853181 Set version to 0.5.0, diverge from Mhysa's versioning 2020-08-03 18:56:44 -04:00
Lewis Diamond
7f1309f45f update pkg name 2020-08-01 22:09:00 -04:00
21 changed files with 52 additions and 39 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "stromjs", "name": "stromjs",
"version": "2.0.0-alpha.1", "version": "0.5.1",
"description": "Dependency-free streams utils for Node.js", "description": "Dependency-free streams utils for Node.js",
"keywords": [ "keywords": [
"promise", "promise",
@ -30,7 +30,7 @@
"dist" "dist"
], ],
"repository": { "repository": {
"url": "git@git.lewis.id:strom/strom.git", "url": "https://github.com/lewisdiamond/stromjs",
"type": "git" "type": "git"
}, },
"scripts": { "scripts": {
@ -47,7 +47,7 @@
"@types/sinon": "^7.0.13", "@types/sinon": "^7.0.13",
"ava": "^2.4.0", "ava": "^2.4.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"mhysa": "./", "stromjs": "./",
"prettier": "^1.14.3", "prettier": "^1.14.3",
"sinon": "^7.4.2", "sinon": "^7.4.2",
"ts-node": "^8.3.0", "ts-node": "^8.3.0",

View File

@ -1,6 +1,7 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a", "b", "c"]) strom
.fromArray(["a", "b", "c"])
.pipe(strom.map(s => Promise.resolve(s + s))) .pipe(strom.map(s => Promise.resolve(s + s)))
.pipe(strom.flatMap(s => Promise.resolve([s, s.toUpperCase()]))) .pipe(strom.flatMap(s => Promise.resolve([s, s.toUpperCase()])))
.pipe(strom.filter(s => Promise.resolve(s !== "bb"))) .pipe(strom.filter(s => Promise.resolve(s !== "bb")))

View File

@ -1,6 +1,7 @@
const strom = require("strom").strom(); const strom = require("stromjs");
const catProcess = require("child_process").exec("grep -o ab"); const catProcess = require("child_process").exec("grep -o ab");
strom.fromArray(["a", "b", "c"]) strom
.fromArray(["a", "b", "c"])
.pipe(strom.child(catProcess)) .pipe(strom.child(catProcess))
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,5 +1,6 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a", "b", "c"]) strom
.fromArray(["a", "b", "c"])
.pipe(strom.collect({ objectMode: true })) .pipe(strom.collect({ objectMode: true }))
.on("data", object => console.log(object)); .on("data", object => console.log(object));

View File

@ -1,5 +1,5 @@
const { Readable } = require("stream"); const { Readable } = require("stream");
const strom = require("strom").strom(); const strom = require("stromjs");
const source1 = new Readable(); const source1 = new Readable();
const source2 = new Readable(); const source2 = new Readable();

View File

@ -1,6 +1,7 @@
const strom = require("strom").strom(); const strom = require("stromjs");
const catProcess = require("child_process").exec("grep -o ab"); const catProcess = require("child_process").exec("grep -o ab");
strom.fromArray(["a", "b", "c"]) strom
.fromArray(["a", "b", "c"])
.pipe(strom.duplex(catProcess.stdin, catProcess.stdout)) .pipe(strom.duplex(catProcess.stdin, catProcess.stdout))
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,6 +1,7 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a", "b", "c"]) strom
.fromArray(["a", "b", "c"])
.pipe(strom.filter(s => s !== "b")) .pipe(strom.filter(s => s !== "b"))
.pipe(strom.join(",")) .pipe(strom.join(","))
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,6 +1,7 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a", "AA"]) strom
.fromArray(["a", "AA"])
.pipe(strom.flatMap(s => new Array(s.length).fill(s))) .pipe(strom.flatMap(s => new Array(s.length).fill(s)))
.pipe(strom.join(",")) .pipe(strom.join(","))
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,5 +1,6 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a", "b", "c"]) strom
.fromArray(["a", "b", "c"])
.pipe(strom.join(",")) .pipe(strom.join(","))
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,4 +1,4 @@
const strom = require("strom").strom(); const strom = require("stromjs");
let f = async () => { let f = async () => {
const source = strom.fromArray(["a", "b", "c"]); const source = strom.fromArray(["a", "b", "c"]);

View File

@ -1,6 +1,7 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a", "b"]) strom
.fromArray(["a", "b"])
.pipe(strom.map(s => s.toUpperCase())) .pipe(strom.map(s => s.toUpperCase()))
.pipe(strom.join(",")) .pipe(strom.join(","))
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,5 +1,5 @@
const { Readable } = require("stream"); const { Readable } = require("stream");
const strom = require("strom").strom(); const strom = require("stromjs");
const source1 = new Readable({ read() {} }); const source1 = new Readable({ read() {} });
const source2 = new Readable({ read() {} }); const source2 = new Readable({ read() {} });

View File

@ -1,4 +1,4 @@
const strom = require("stromjs").strom(); const strom = require("stromjs");
function sleep(time) { function sleep(time) {
return time > 0 ? new Promise(resolve => setTimeout(resolve, time)) : null; return time > 0 ? new Promise(resolve => setTimeout(resolve, time)) : null;

View File

@ -1,5 +1,6 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(['{ "a": "b" }']) strom
.fromArray(['{ "a": "b" }'])
.pipe(strom.parse()) .pipe(strom.parse())
.on("data", object => console.log(object)); .on("data", object => console.log(object));

View File

@ -1,4 +1,4 @@
const strom = require("../dist/index.js"); const strom = require("stromjs");
function sleep(time) { function sleep(time) {
return time > 0 ? new Promise(resolve => setTimeout(resolve, time)) : null; return time > 0 ? new Promise(resolve => setTimeout(resolve, time)) : null;

View File

@ -1,6 +1,7 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a", "b", "cc"]) strom
.fromArray(["a", "b", "cc"])
.pipe(strom.reduce((acc, s) => ({ ...acc, [s]: s.length }), {})) .pipe(strom.reduce((acc, s) => ({ ...acc, [s]: s.length }), {}))
.pipe(strom.stringify()) .pipe(strom.stringify())
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,5 +1,6 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a1", "b22", "c333"]) strom
.fromArray(["a1", "b22", "c333"])
.pipe(strom.replace(/b\d+/, "B")) .pipe(strom.replace(/b\d+/, "B"))
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,6 +1,7 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray(["a,b", "c,d"]) strom
.fromArray(["a,b", "c,d"])
.pipe(strom.split(",")) .pipe(strom.split(","))
.pipe(strom.join("|")) .pipe(strom.join("|"))
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1,5 +1,6 @@
const strom = require("strom").strom(); const strom = require("stromjs");
strom.fromArray([{ a: "b" }]) strom
.fromArray([{ a: "b" }])
.pipe(strom.stringify()) .pipe(strom.stringify())
.pipe(process.stdout); .pipe(process.stdout);

View File

@ -1934,9 +1934,6 @@ merge2@^1.2.3, merge2@^1.3.0:
resolved "https://npm.dev.jogogo.co/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" resolved "https://npm.dev.jogogo.co/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81"
integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==
mhysa@./:
version "2.0.0-alpha.1"
micromatch@^4.0.2: micromatch@^4.0.2:
version "4.0.2" version "4.0.2"
resolved "https://npm.dev.jogogo.co/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" resolved "https://npm.dev.jogogo.co/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259"
@ -2719,6 +2716,9 @@ strip-json-comments@~2.0.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
stromjs@./:
version "0.5.1"
supertap@^1.0.0: supertap@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/supertap/-/supertap-1.0.0.tgz#bd9751c7fafd68c68cf8222a29892206a119fa9e" resolved "https://registry.yarnpkg.com/supertap/-/supertap-1.0.0.tgz#bd9751c7fafd68c68cf8222a29892206a119fa9e"