@johngw/stream
Version:
Reactive programming tools using the WHATWG Streams API.
23 lines • 504 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.of = void 0;
/**
* Creates a ReadableStream the queues `x` and closes.
*
* @group Sources
* @example
* ```
* await of({ foo: 'bar' }).pipeTo(write(x => console.info(x)))
* // { foo: 'bar' }
* ```
*/
function of(x) {
return new ReadableStream({
pull(controller) {
controller.enqueue(x);
controller.close();
},
});
}
exports.of = of;
//# sourceMappingURL=of.js.map