Update package to use itself in dev, update samples

This commit is contained in:
Lewis Diamond 2020-08-05 19:08:13 -04:00
parent fc5b96f725
commit 2fb7942d9c
20 changed files with 48 additions and 35 deletions

View File

@ -47,7 +47,7 @@
"@types/sinon": "^7.0.13",
"ava": "^2.4.0",
"chai": "^4.2.0",
"mhysa": "./",
"stromjs": "./",
"prettier": "^1.14.3",
"sinon": "^7.4.2",
"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.flatMap(s => Promise.resolve([s, s.toUpperCase()])))
.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");
strom.fromArray(["a", "b", "c"])
strom
.fromArray(["a", "b", "c"])
.pipe(strom.child(catProcess))
.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 }))
.on("data", object => console.log(object));

View File

@ -1,5 +1,5 @@
const { Readable } = require("stream");
const strom = require("strom").strom();
const strom = require("stromjs");
const source1 = 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");
strom.fromArray(["a", "b", "c"])
strom
.fromArray(["a", "b", "c"])
.pipe(strom.duplex(catProcess.stdin, catProcess.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.join(","))
.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.join(","))
.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(process.stdout);

View File

@ -1,4 +1,4 @@
const strom = require("strom").strom();
const strom = require("stromjs");
let f = async () => {
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.join(","))
.pipe(process.stdout);

View File

@ -1,5 +1,5 @@
const { Readable } = require("stream");
const strom = require("strom").strom();
const strom = require("stromjs");
const source1 = 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) {
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())
.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) {
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.stringify())
.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(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.join("|"))
.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(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"
integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw==
mhysa@./:
version "2.0.0-alpha.1"
micromatch@^4.0.2:
version "4.0.2"
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"
integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo=
stromjs@./:
version "0.5.1"
supertap@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/supertap/-/supertap-1.0.0.tgz#bd9751c7fafd68c68cf8222a29892206a119fa9e"