UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

14 lines 375 B
export function filter(predicate) { return new TransformStream({ async transform(chunk, controller) { try { if (await predicate(chunk)) controller.enqueue(chunk); } catch (error) { controller.error(error); } }, }); } //# sourceMappingURL=filter.js.map