strom/samples/async.js

9 lines
305 B
JavaScript
Raw Normal View History

2020-07-04 15:06:41 +00:00
const strom = require("strom").strom();
2018-12-03 05:38:17 +00:00
2020-07-04 04:08:31 +00:00
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(","))
2018-12-03 05:38:17 +00:00
.pipe(process.stdout);