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) • 470 B
text/typescript
import { sflow } from "./sflow";
it("chunkBy", async () => {
const out = await sflow([1, 1.1, 1.00002, 1.9, 3, 3, 3, 3, 4, 5, 4, 3])
.chunkBy((x) => Math.floor(x))
.toArray();
console.log(out);
expect(out).toEqual([
[], // same floor will chunk together
[], // same ord will chunk together
[], // single item
[], // break order
[], // only chunk continues order
[], // chunk single item
]);
});