@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
26 lines • 506 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.first = void 0;
/**
* Queues the first item it receives then terminates the stream.
*
* @group Transformers
* @example
* ```
* --1--X
*
* first()
*
* --1--|
* ```
*/
function first() {
return new TransformStream({
transform(chunk, controller) {
controller.enqueue(chunk);
controller.terminate();
},
});
}
exports.first = first;
//# sourceMappingURL=first.js.map