UNPKG

ix

Version:

The Interactive Extensions for JavaScript

30 lines (28 loc) 1.17 kB
import { AsyncIterableX } from './asynciterablex.mjs'; import { Transform } from 'stream'; const asyncIterableMixin = Symbol('asyncIterableMixin'); /** @ignore */ export function AsyncIterableTransform(options) { Transform.call(this, options); // If this is the first time AsyncIterableTransform is being constructed, // mixin the methods from the AsyncIterableX's prototype. if (!AsyncIterableTransform[asyncIterableMixin]) { AsyncIterableTransform[asyncIterableMixin] = true; Object.defineProperties(AsyncIterableTransform.prototype, Object.getOwnPropertyDescriptors(AsyncIterableX.prototype)); } } AsyncIterableTransform.prototype = Object.create(Transform.prototype); AsyncIterableTransform[asyncIterableMixin] = false; /** @nocollapse */ AsyncIterableTransform.prototype._flush = function (callback) { callback(); }; /** @nocollapse */ AsyncIterableTransform.prototype._transform = function (chunk, _encoding, callback) { callback(null, chunk); }; /** @ignore */ export function asAsyncIterable(options = {}) { return Reflect.construct(AsyncIterableTransform, [options]); } //# sourceMappingURL=asasynciterable.mjs.map