UNPKG

sflow

Version:

sflow is a powerful and highly-extensible library designed for processing and manipulating streams of data effortlessly. Inspired by the functional programming paradigm, it provides a rich set of utilities for transforming streams, including chunking, fil

17 lines (15 loc) 383 B
import { distributeBys } from "./distributeBys"; import { rangeStream } from "./rangeStream"; import { sflow } from "./sf"; it("distributeBys", async () => { expect( await sflow(rangeStream(10)) .through(distributeBys((e: number) => e % 3)) .pMap((s) => sflow(s).toArray()) .toArray(), ).toEqual([ [0, 3, 6, 9], [1, 4, 7], [2, 5, 8], ]); });