strom/samples/async.js

9 lines
297 B
JavaScript
Raw Normal View History

2018-12-03 05:38:17 +00:00
const Mhysa = require("mhysa");
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(","))
.pipe(process.stdout);