1 line
16 KiB
JSON
1 line
16 KiB
JSON
{"id":"/7BO","dependencies":[{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/reduce.js.map","includedInParent":true,"mtime":499162500000},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/src/internal/operators/reduce.ts","includedInParent":true,"mtime":499162500000},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/package.json","includedInParent":true,"mtime":1545395749058},{"name":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/package.json","includedInParent":true,"mtime":1545395355370},{"name":"./scan","loc":{"line":2,"column":21},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/reduce.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/scan.js"},{"name":"./takeLast","loc":{"line":3,"column":25},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/reduce.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/takeLast.js"},{"name":"./defaultIfEmpty","loc":{"line":4,"column":31},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/reduce.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js"},{"name":"../util/pipe","loc":{"line":5,"column":21},"parent":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/operators/reduce.js","resolved":"/Users/philkunz/gitlab/pushrocks_meta/webdetector/node_modules/rxjs/_esm5/internal/util/pipe.js"}],"generated":{"js":"\"use strict\";Object.defineProperty(exports,\"__esModule\",{value:!0}),exports.reduce=n;var e=require(\"./scan\"),t=require(\"./takeLast\"),r=require(\"./defaultIfEmpty\"),u=require(\"../util/pipe\");function n(n,i){return arguments.length>=2?function(a){return(0,u.pipe)((0,e.scan)(n,i),(0,t.takeLast)(1),(0,r.defaultIfEmpty)(i))(a)}:function(r){return(0,u.pipe)((0,e.scan)(function(e,t,r){return n(e,t,r+1)}),(0,t.takeLast)(1))(r)}}","map":{"mappings":[{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":0}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":13}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":20}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":35}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":43}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":56}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":57}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":64}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":68}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":76}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":79,"column":1},"generated":{"line":1,"column":83}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":1,"column":85}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":1,"column":89}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":1,"column":91}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":3,"column":0},"generated":{"line":1,"column":99}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":4,"column":0},"generated":{"line":1,"column":109}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":4,"column":0},"generated":{"line":1,"column":111}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":4,"column":0},"generated":{"line":1,"column":119}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":6,"column":0},"generated":{"line":1,"column":133}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":6,"column":0},"generated":{"line":1,"column":135}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":6,"column":0},"generated":{"line":1,"column":143}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":62,"column":0},"generated":{"line":1,"column":163}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":62,"column":0},"generated":{"line":1,"column":165}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":62,"column":0},"generated":{"line":1,"column":173}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":68,"column":2},"generated":{"line":1,"column":189}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":68,"column":6},"generated":{"line":1,"column":198}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":68,"column":16},"generated":{"line":1,"column":200}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":68,"column":29},"generated":{"line":1,"column":202}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":69,"column":4},"generated":{"line":1,"column":205}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":69,"column":4},"generated":{"line":1,"column":212}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":69,"column":11},"generated":{"line":1,"column":222}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":69,"column":20},"generated":{"line":1,"column":230}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":70,"column":6},"generated":{"line":1,"column":232}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":70,"column":43},"generated":{"line":1,"column":241}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":244}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":251}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":253}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":255}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":262}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":264}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":266}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":272}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":274}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":278}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":280}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":282}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":292}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":296}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":298}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":300}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":316}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":319}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":71,"column":6},"generated":{"line":1,"column":320}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":74,"column":4},"generated":{"line":1,"column":324}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":75,"column":20},"generated":{"line":1,"column":333}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":336}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":343}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":345}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":347}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":354}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":356}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":358}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":364}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":373}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":375}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":377}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":380}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":387}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":389}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":391}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":393}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":395}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":401}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":403}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":405}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":415}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":418}},{"source":"../../../src/internal/operators/reduce.ts","name":null,"original":{"line":78,"column":4},"generated":{"line":1,"column":419}}],"sources":{"../../../src/internal/operators/reduce.ts":"import { Observable } from '../Observable';\nimport { scan } from './scan';\nimport { takeLast } from './takeLast';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { OperatorFunction, MonoTypeOperatorFunction } from '../types';\nimport { pipe } from '../util/pipe';\n\n/* tslint:disable:max-line-length */\nexport function reduce<T>(accumulator: (acc: T, value: T, index: number) => T, seed?: T): MonoTypeOperatorFunction<T>;\nexport function reduce<T>(accumulator: (acc: T[], value: T, index: number) => T[], seed: T[]): OperatorFunction<T, T[]>;\nexport function reduce<T, R>(accumulator: (acc: R, value: T, index: number) => R, seed?: R): OperatorFunction<T, R>;\n/* tslint:enable:max-line-length */\n\n/**\n * Applies an accumulator function over the source Observable, and returns the\n * accumulated result when the source completes, given an optional seed value.\n *\n * <span class=\"informal\">Combines together all values emitted on the source,\n * using an accumulator function that knows how to join a new source value into\n * the accumulation from the past.</span>\n *\n * ![](reduce.png)\n *\n * Like\n * [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce),\n * `reduce` applies an `accumulator` function against an accumulation and each\n * value of the source Observable (from the past) to reduce it to a single\n * value, emitted on the output Observable. Note that `reduce` will only emit\n * one value, only when the source Observable completes. It is equivalent to\n * applying operator {@link scan} followed by operator {@link last}.\n *\n * Returns an Observable that applies a specified `accumulator` function to each\n * item emitted by the source Observable. If a `seed` value is specified, then\n * that value will be used as the initial value for the accumulator. If no seed\n * value is specified, the first item of the source is used as the seed.\n *\n * ## Example\n * Count the number of click events that happened in 5 seconds\n * ```javascript\n * const clicksInFiveSeconds = fromEvent(document, 'click').pipe(\n * takeUntil(interval(5000)),\n * );\n * const ones = clicksInFiveSeconds.pipe(mapTo(1));\n * const seed = 0;\n * const count = ones.reduce((acc, one) => acc + one, seed);\n * count.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link count}\n * @see {@link expand}\n * @see {@link mergeScan}\n * @see {@link scan}\n *\n * @param {function(acc: R, value: T, index: number): R} accumulator The accumulator function\n * called on each source value.\n * @param {R} [seed] The initial accumulation value.\n * @return {Observable<R>} An Observable that emits a single value that is the\n * result of accumulating the values emitted by the source Observable.\n * @method reduce\n * @owner Observable\n */\nexport function reduce<T, R>(accumulator: (acc: R, value: T, index?: number) => R, seed?: R): OperatorFunction<T, R> {\n // providing a seed of `undefined` *should* be valid and trigger\n // hasSeed! so don't use `seed !== undefined` checks!\n // For this reason, we have to check it here at the original call site\n // otherwise inside Operator/Subscriber we won't know if `undefined`\n // means they didn't provide anything or if they literally provided `undefined`\n if (arguments.length >= 2) {\n return function reduceOperatorFunctionWithSeed(source: Observable<T>): Observable<R> {\n return pipe(scan(accumulator, seed), takeLast(1), defaultIfEmpty(seed))(source);\n };\n }\n return function reduceOperatorFunction(source: Observable<T>): Observable<R> {\n return pipe(\n scan((acc: R, value: T, index: number): R => accumulator(acc, value, index + 1)),\n takeLast(1),\n )(source);\n };\n}\n"},"lineCount":null}},"hash":"ee03e82098c07044914e8116f061f695","cacheData":{"env":{}}} |