@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
18 lines • 495 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.filter = void 0;
function filter(predicate) {
return new TransformStream({
async transform(chunk, controller) {
try {
if (await predicate(chunk))
controller.enqueue(chunk);
}
catch (error) {
controller.error(error);
}
},
});
}
exports.filter = filter;
//# sourceMappingURL=filter.js.map