strom/samples/reduce.js

8 lines
199 B
JavaScript
Raw Permalink Normal View History

const strom = require("stromjs");
2018-12-03 05:38:17 +00:00
strom
.fromArray(["a", "b", "cc"])
2020-07-04 04:08:31 +00:00
.pipe(strom.reduce((acc, s) => ({ ...acc, [s]: s.length }), {}))
.pipe(strom.stringify())
2018-12-03 05:38:17 +00:00
.pipe(process.stdout);