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
12 lines (10 loc) • 314 B
text/typescript
import { sflow } from "./sflow";
it("works", async () => {
const fn0 = jest.fn();
const fn1 = jest.fn();
expect(
await sflow([1, 2, 3, 4]).forEach(fn0).limit(2).forEach(fn1).toArray()
).toEqual([1, 2]);
expect(fn0).toHaveBeenCalledTimes(2); // lazy limit
expect(fn1).toHaveBeenCalledTimes(2);
});