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