{"version":3,"sources":["iterable/defer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,aAAiB,SAAQ,SAAY;IAGzC,YAAY,EAAqB;QAC/B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAChB,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE;YAC7B,MAAM,IAAI,CAAC;SACZ;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,KAAK,CAAU,OAAgC;IAC7D,OAAO,IAAI,aAAa,CAAU,OAAO,CAAC,CAAC;AAC7C,CAAC","file":"defer.js","sourcesContent":["import { IterableX } from './iterablex';\n\nclass DeferIterable<T> extends IterableX<T> {\n  private _fn: () => Iterable<T>;\n\n  constructor(fn: () => Iterable<T>) {\n    super();\n    this._fn = fn;\n  }\n\n  *[Symbol.iterator]() {\n    for (const item of this._fn()) {\n      yield item;\n    }\n  }\n}\n\n/**\n * Returns an iterable sequence that invokes the specified factory function whenever a call to [Symbol.iterator] has been made.\n *\n * @export\n * @template TSource The type of the elements in the sequence returned by the factory function, and in the resulting sequence.\n * @param {(() => Iterable<TSource>)} factory iterable factory function to invoke for each call to [Symbol.iterator].\n * @returns {AsyncIterableX<TSource>} An iterable sequence whose observers trigger an invocation of the given iterable factory function.\n */\nexport function defer<TSource>(factory: () => Iterable<TSource>): IterableX<TSource> {\n  return new DeferIterable<TSource>(factory);\n}\n"]}