strom/samples/async.js
2020-07-04 11:06:41 -04:00

9 lines
305 B
JavaScript

const strom = require("strom").strom();
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);