{"version":3,"sources":["asynciterable/operators/endwith.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,OAAO,oBAA8B,SAAQ,cAAuB;IAIxE,YAAY,MAA8B,EAAE,IAAe;QACzD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,MAAoB;QAChD,cAAc,CAAC,MAAM,CAAC,CAAC;QACvB,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;YAC5D,MAAM,IAAI,CAAC;SACZ;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE;YAC1B,MAAM,CAAC,CAAC;SACT;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAU,GAAG,IAAe;IACjD,OAAO,SAAS,wBAAwB,CACtC,MAA8B;QAE9B,OAAO,IAAI,oBAAoB,CAAU,MAAM,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC,CAAC;AACJ,CAAC","file":"endwith.js","sourcesContent":["import { AsyncIterableX } from '../asynciterablex';\nimport { MonoTypeOperatorAsyncFunction } from '../../interfaces';\nimport { wrapWithAbort } from './withabort';\nimport { throwIfAborted } from '../../aborterror';\n\nexport class EndWithAsyncIterable<TSource> extends AsyncIterableX<TSource> {\n  private _source: AsyncIterable<TSource>;\n  private _args: TSource[];\n\n  constructor(source: AsyncIterable<TSource>, args: TSource[]) {\n    super();\n    this._source = source;\n    this._args = args;\n  }\n\n  async *[Symbol.asyncIterator](signal?: AbortSignal) {\n    throwIfAborted(signal);\n    for await (const item of wrapWithAbort(this._source, signal)) {\n      yield item;\n    }\n    for (const x of this._args) {\n      yield x;\n    }\n  }\n}\n\n/**\n * Append values to an async-iterable sequence.\n *\n * @export\n * @template TSource The type of the elements in the source sequence.\n * @param {...TSource[]} args The values to append to the end of the async-iterable sequence.\n * @returns {MonoTypeOperatorAsyncFunction<TSource>} An operator which appends values to the end of the sequence.\n */\nexport function endWith<TSource>(...args: TSource[]): MonoTypeOperatorAsyncFunction<TSource> {\n  return function endsWithOperatorFunction(\n    source: AsyncIterable<TSource>\n  ): AsyncIterableX<TSource> {\n    return new EndWithAsyncIterable<TSource>(source, args);\n  };\n}\n"]}