biofriction-wp-theme/node_modules/rxjs/operator/groupBy.js.map

1 line
4.7 KiB
Plaintext

{"version":3,"file":"groupBy.js","sourceRoot":"","sources":["../../src/operator/groupBy.ts"],"names":[],"mappings":";AAGA,wBAA0D,sBAAsB,CAAC,CAAA;AACxE,yBAAiB;AAO1B,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,iBAAsD,WAA4B,EACjD,eAA0C,EAC1C,gBAAwE,EACxE,eAAkC;IACjE,MAAM,CAAC,iBAAW,CAAC,WAAW,EAAE,eAAsB,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC;AACnG,CAAC;AALe,eAAO,UAKtB,CAAA","sourcesContent":["\nimport { Observable } from '../Observable';\nimport { Subject } from '../Subject';\nimport { groupBy as higherOrder, GroupedObservable } from '../operators/groupBy';\nexport { GroupedObservable };\n\n/* tslint:disable:max-line-length */\nexport function groupBy<T, K>(this: Observable<T>, keySelector: (value: T) => K): Observable<GroupedObservable<K, T>>;\nexport function groupBy<T, K>(this: Observable<T>, keySelector: (value: T) => K, elementSelector: void, durationSelector: (grouped: GroupedObservable<K, T>) => Observable<any>): Observable<GroupedObservable<K, T>>;\nexport function groupBy<T, K, R>(this: Observable<T>, keySelector: (value: T) => K, elementSelector?: (value: T) => R, durationSelector?: (grouped: GroupedObservable<K, R>) => Observable<any>): Observable<GroupedObservable<K, R>>;\nexport function groupBy<T, K, R>(this: Observable<T>, keySelector: (value: T) => K, elementSelector?: (value: T) => R, durationSelector?: (grouped: GroupedObservable<K, R>) => Observable<any>, subjectSelector?: () => Subject<R>): Observable<GroupedObservable<K, R>>;\n/* tslint:enable:max-line-length */\n\n/**\n * Groups the items emitted by an Observable according to a specified criterion,\n * and emits these grouped items as `GroupedObservables`, one\n * {@link GroupedObservable} per group.\n *\n * <img src=\"./img/groupBy.png\" width=\"100%\">\n *\n * @example <caption>Group objects by id and return as array</caption>\n * Observable.of<Obj>({id: 1, name: 'aze1'},\n * {id: 2, name: 'sf2'},\n * {id: 2, name: 'dg2'},\n * {id: 1, name: 'erg1'},\n * {id: 1, name: 'df1'},\n * {id: 2, name: 'sfqfb2'},\n * {id: 3, name: 'qfs3'},\n * {id: 2, name: 'qsgqsfg2'}\n * )\n * .groupBy(p => p.id)\n * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], []))\n * .subscribe(p => console.log(p));\n *\n * // displays:\n * // [ { id: 1, name: 'aze1' },\n * // { id: 1, name: 'erg1' },\n * // { id: 1, name: 'df1' } ]\n * //\n * // [ { id: 2, name: 'sf2' },\n * // { id: 2, name: 'dg2' },\n * // { id: 2, name: 'sfqfb2' },\n * // { id: 2, name: 'qsgqsfg2' } ]\n * //\n * // [ { id: 3, name: 'qfs3' } ]\n *\n * @example <caption>Pivot data on the id field</caption>\n * Observable.of<Obj>({id: 1, name: 'aze1'},\n * {id: 2, name: 'sf2'},\n * {id: 2, name: 'dg2'},\n * {id: 1, name: 'erg1'},\n * {id: 1, name: 'df1'},\n * {id: 2, name: 'sfqfb2'},\n * {id: 3, name: 'qfs1'},\n * {id: 2, name: 'qsgqsfg2'}\n * )\n * .groupBy(p => p.id, p => p.name)\n * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [\"\" + group$.key]))\n * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)}))\n * .subscribe(p => console.log(p));\n *\n * // displays:\n * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] }\n * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] }\n * // { id: 3, values: [ 'qfs1' ] }\n *\n * @param {function(value: T): K} keySelector A function that extracts the key\n * for each item.\n * @param {function(value: T): R} [elementSelector] A function that extracts the\n * return element for each item.\n * @param {function(grouped: GroupedObservable<K,R>): Observable<any>} [durationSelector]\n * A function that returns an Observable to determine how long each group should\n * exist.\n * @return {Observable<GroupedObservable<K,R>>} An Observable that emits\n * GroupedObservables, each of which corresponds to a unique key value and each\n * of which emits those items from the source Observable that share that key\n * value.\n * @method groupBy\n * @owner Observable\n */\nexport function groupBy<T, K, R>(this: Observable<T>, keySelector: (value: T) => K,\n elementSelector?: ((value: T) => R) | void,\n durationSelector?: (grouped: GroupedObservable<K, R>) => Observable<any>,\n subjectSelector?: () => Subject<R>): Observable<GroupedObservable<K, R>> {\n return higherOrder(keySelector, elementSelector as any, durationSelector, subjectSelector)(this);\n}\n"]}