strom/samples/reduce.js
2018-12-03 00:59:31 -05:00

7 lines
192 B
JavaScript

const Mhysa = require("mhysa");
Mhysa.fromArray(["a", "b", "cc"])
.pipe(Mhysa.reduce((acc, s) => ({ ...acc, [s]: s.length }), {}))
.pipe(Mhysa.stringify())
.pipe(process.stdout);