UNPKG

@johngw/stream

Version:

Reactive programming tools using the WHATWG Streams API.

19 lines 396 B
/** * Creates a ReadableStream the queues `x` and closes. * * @group Sources * @example * ``` * await of({ foo: 'bar' }).pipeTo(write(x => console.info(x))) * // { foo: 'bar' } * ``` */ export function of(x) { return new ReadableStream({ pull(controller) { controller.enqueue(x); controller.close(); }, }); } //# sourceMappingURL=of.js.map