{"version":3,"sources":["iterable/operators/pairwise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,OAAO,gBAA0B,SAAQ,SAAoB;IAGjE,YAAY,MAAyB;QACnC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,IAAI,KAA0B,CAAC;QAC/B,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;YAC/B,IAAI,CAAC,QAAQ,EAAE;gBACb,QAAQ,GAAG,IAAI,CAAC;aACjB;iBAAM;gBACL,MAAM,CAAC,KAAM,EAAE,IAAI,CAAC,CAAC;aACtB;YACD,KAAK,GAAG,IAAI,CAAC;SACd;IACH,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,SAAS,wBAAwB,CAAC,MAAyB;QAChE,OAAO,IAAI,gBAAgB,CAAU,MAAM,CAAC,CAAC;IAC/C,CAAC,CAAC;AACJ,CAAC","file":"pairwise.js","sourcesContent":["import { IterableX } from '../iterablex';\nimport { OperatorFunction } from '../../interfaces';\n\nexport class PairwiseIterable<TSource> extends IterableX<TSource[]> {\n  private _source: Iterable<TSource>;\n\n  constructor(source: Iterable<TSource>) {\n    super();\n    this._source = source;\n  }\n\n  *[Symbol.iterator]() {\n    let value: TSource | undefined;\n    let hasValue = false;\n    for (const item of this._source) {\n      if (!hasValue) {\n        hasValue = true;\n      } else {\n        yield [value!, item];\n      }\n      value = item;\n    }\n  }\n}\n\n/**\n * Returns a sequence of each element in the input sequence and its predecessor, with the exception of the\n * first element which is only returned as the predecessor of the second element.\n *\n * @export\n * @template TSource The type of the elements in the source sequence.\n * @returns {OperatorFunction<TSource, TSource[]>} The result sequence.\n */\nexport function pairwise<TSource>(): OperatorFunction<TSource, TSource[]> {\n  return function pairwiseOperatorFunction(source: Iterable<TSource>): IterableX<TSource[]> {\n    return new PairwiseIterable<TSource>(source);\n  };\n}\n"]}