{"version":3,"sources":["iterable/operators/takewhile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,OAAO,iBAA2B,SAAQ,SAAkB;IAIhE,YAAY,MAAyB,EAAE,SAAqD;QAC1F,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;YAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE;gBAC/B,MAAM;aACP;YACD,MAAM,IAAI,CAAC;SACZ;IACH,CAAC;CACF;AA2BD;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CACvB,SAA+C;IAE/C,OAAO,SAAS,yBAAyB,CAAC,MAAmB;QAC3D,OAAO,IAAI,iBAAiB,CAAI,MAAM,EAAE,SAAS,CAAC,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC","file":"takewhile.js","sourcesContent":["import { IterableX } from '../iterablex';\nimport { OperatorFunction } from '../../interfaces';\n\nexport class TakeWhileIterable<TSource> extends IterableX<TSource> {\n  private _source: Iterable<TSource>;\n  private _predicate: (value: TSource, index: number) => boolean;\n\n  constructor(source: Iterable<TSource>, predicate: (value: TSource, index: number) => boolean) {\n    super();\n    this._source = source;\n    this._predicate = predicate;\n  }\n\n  *[Symbol.iterator]() {\n    let i = 0;\n    for (const item of this._source) {\n      if (!this._predicate(item, i++)) {\n        break;\n      }\n      yield item;\n    }\n  }\n}\n\n/**\n * Returns elements from an iterable sequence as long as a specified condition is true.\n *\n * @export\n * @template T The type of the elements in the source sequence.\n * @template S The result of the predicate that is truthy/falsy.\n * @param {(value: T, index: number) => value is S} predicate A function to test each element for a condition.\n * @returns {OperatorFunction<T, S>} An iterable sequence that contains the elements from the input sequence that occur\n * before the element at which the test no longer passes.\n */\nexport function takeWhile<T, S extends T>(\n  predicate: (value: T, index: number) => value is S\n): OperatorFunction<T, S>;\n/**\n * Returns elements from an iterable sequence as long as a specified condition is true.\n *\n * @export\n * @template T The type of the elements in the source sequence.\n * @param {((value: T, index: number) => boolean)} predicate A function to test each element for a condition.\n * @returns {OperatorFunction<T, T>} An iterable sequence that contains the elements from the input sequence that occur\n * before the element at which the test no longer passes.\n */\nexport function takeWhile<T>(\n  predicate: (value: T, index: number) => boolean\n): OperatorFunction<T, T>;\n/**\n * Returns elements from an iterable sequence as long as a specified condition is true.\n *\n * @export\n * @template T The type of the elements in the source sequence.\n * @param {((value: T, index: number) => boolean)} predicate A function to test each element for a condition.\n * @returns {OperatorFunction<T, T>} An iterable sequence that contains the elements from the input sequence that occur\n * before the element at which the test no longer passes.\n */\nexport function takeWhile<T>(\n  predicate: (value: T, index: number) => boolean\n): OperatorFunction<T, T> {\n  return function takeWhileOperatorFunction(source: Iterable<T>): IterableX<T> {\n    return new TakeWhileIterable<T>(source, predicate);\n  };\n}\n"]}