@rainydio/through-reduce

1.0.1 • Public • Published

Similar to Array.prototype.reduce

"use strict";

const assert = require("assert");
const through = require("through2");
const reduce = require("@rainydio/through-reduce");

const stream = through.obj();
stream
	.pipe(reduce((a, b) => a + b, 0))
	.pipe(through.obj((sum, enc, done) => {
		assert(sum === 6);
		done();
	}));

stream.write(1);
stream.write(2);
stream.write(3);
stream.end();

Readme

Keywords

none

Package Sidebar

Install

npm i @rainydio/through-reduce

Weekly Downloads

2

Version

1.0.1

License

ISC

Last publish

Collaborators

  • rainydio