Quick rename
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a", "b", "c"])
|
||||
.pipe(Mhysa.map(s => Promise.resolve(s + s)))
|
||||
.pipe(Mhysa.flatMap(s => Promise.resolve([s, s.toUpperCase()])))
|
||||
.pipe(Mhysa.filter(s => Promise.resolve(s !== "bb")))
|
||||
.pipe(Mhysa.join(","))
|
||||
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")))
|
||||
.pipe(strom.join(","))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
const catProcess = require("child_process").exec("grep -o ab");
|
||||
|
||||
Mhysa.fromArray(["a", "b", "c"])
|
||||
.pipe(Mhysa.child(catProcess))
|
||||
strom.fromArray(["a", "b", "c"])
|
||||
.pipe(strom.child(catProcess))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a", "b", "c"])
|
||||
.pipe(Mhysa.collect({ objectMode: true }))
|
||||
strom.fromArray(["a", "b", "c"])
|
||||
.pipe(strom.collect({ objectMode: true }))
|
||||
.on("data", object => console.log(object));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
const { Readable } = require("stream");
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
const source1 = new Readable();
|
||||
const source2 = new Readable();
|
||||
Mhysa.concat(source1, source2).pipe(process.stdout);
|
||||
strom.concat(source1, source2).pipe(process.stdout);
|
||||
source1.push("a1 ");
|
||||
source2.push("c3 ");
|
||||
source1.push("b2 ");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
const catProcess = require("child_process").exec("grep -o ab");
|
||||
|
||||
Mhysa.fromArray(["a", "b", "c"])
|
||||
.pipe(Mhysa.duplex(catProcess.stdin, catProcess.stdout))
|
||||
strom.fromArray(["a", "b", "c"])
|
||||
.pipe(strom.duplex(catProcess.stdin, catProcess.stdout))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a", "b", "c"])
|
||||
.pipe(Mhysa.filter(s => s !== "b"))
|
||||
.pipe(Mhysa.join(","))
|
||||
strom.fromArray(["a", "b", "c"])
|
||||
.pipe(strom.filter(s => s !== "b"))
|
||||
.pipe(strom.join(","))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a", "AA"])
|
||||
.pipe(Mhysa.flatMap(s => new Array(s.length).fill(s)))
|
||||
.pipe(Mhysa.join(","))
|
||||
strom.fromArray(["a", "AA"])
|
||||
.pipe(strom.flatMap(s => new Array(s.length).fill(s)))
|
||||
.pipe(strom.join(","))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a", "b", "c"])
|
||||
.pipe(Mhysa.join(","))
|
||||
strom.fromArray(["a", "b", "c"])
|
||||
.pipe(strom.join(","))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
let f = async () => {
|
||||
const source = Mhysa.fromArray(["a", "b", "c"]);
|
||||
console.log(await Mhysa.last(source));
|
||||
const source = strom.fromArray(["a", "b", "c"]);
|
||||
console.log(await strom.last(source));
|
||||
};
|
||||
f();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a", "b"])
|
||||
.pipe(Mhysa.map(s => s.toUpperCase()))
|
||||
.pipe(Mhysa.join(","))
|
||||
strom.fromArray(["a", "b"])
|
||||
.pipe(strom.map(s => s.toUpperCase()))
|
||||
.pipe(strom.join(","))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
const { Readable } = require("stream");
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
const source1 = new Readable({ read() {} });
|
||||
const source2 = new Readable({ read() {} });
|
||||
Mhysa.merge(source1, source2).pipe(process.stdout);
|
||||
strom.merge(source1, source2).pipe(process.stdout);
|
||||
source1.push("a1 ");
|
||||
setTimeout(() => source2.push("c3 "), 10);
|
||||
setTimeout(() => source1.push("b2 "), 20);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(['{ "a": "b" }'])
|
||||
.pipe(Mhysa.parse())
|
||||
strom.fromArray(['{ "a": "b" }'])
|
||||
.pipe(strom.parse())
|
||||
.on("data", object => console.log(object));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a", "b", "cc"])
|
||||
.pipe(Mhysa.reduce((acc, s) => ({ ...acc, [s]: s.length }), {}))
|
||||
.pipe(Mhysa.stringify())
|
||||
strom.fromArray(["a", "b", "cc"])
|
||||
.pipe(strom.reduce((acc, s) => ({ ...acc, [s]: s.length }), {}))
|
||||
.pipe(strom.stringify())
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a1", "b22", "c333"])
|
||||
.pipe(Mhysa.replace(/b\d+/, "B"))
|
||||
strom.fromArray(["a1", "b22", "c333"])
|
||||
.pipe(strom.replace(/b\d+/, "B"))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray(["a,b", "c,d"])
|
||||
.pipe(Mhysa.split(","))
|
||||
.pipe(Mhysa.join("|"))
|
||||
strom.fromArray(["a,b", "c,d"])
|
||||
.pipe(strom.split(","))
|
||||
.pipe(strom.join("|"))
|
||||
.pipe(process.stdout);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Mhysa = require("mhysa");
|
||||
const strom = require("strom");
|
||||
|
||||
Mhysa.fromArray([{ a: "b" }])
|
||||
.pipe(Mhysa.stringify())
|
||||
strom.fromArray([{ a: "b" }])
|
||||
.pipe(strom.stringify())
|
||||
.pipe(process.stdout);
|
||||
|
||||
Reference in New Issue
Block a user