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

12 lines (10 loc) 324 B
import { limits } from "./limits"; import { skips } from "./skips"; export function slices<T>(start = 0, end = Infinity) { const count = end - start; const { readable, writable } = new TransformStream<T, T>(); return { writable, readable: readable.pipeThrough(skips(start)).pipeThrough(limits(count)), }; }