Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/rxjs/operator/ |
Upload File : |
"use strict"; var groupBy_1 = require('../operators/groupBy'); exports.GroupedObservable = groupBy_1.GroupedObservable; /* tslint:enable:max-line-length */ /** * Groups the items emitted by an Observable according to a specified criterion, * and emits these grouped items as `GroupedObservables`, one * {@link GroupedObservable} per group. * * <img src="./img/groupBy.png" width="100%"> * * @example <caption>Group objects by id and return as array</caption> * Observable.of<Obj>({id: 1, name: 'aze1'}, * {id: 2, name: 'sf2'}, * {id: 2, name: 'dg2'}, * {id: 1, name: 'erg1'}, * {id: 1, name: 'df1'}, * {id: 2, name: 'sfqfb2'}, * {id: 3, name: 'qfs3'}, * {id: 2, name: 'qsgqsfg2'} * ) * .groupBy(p => p.id) * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [])) * .subscribe(p => console.log(p)); * * // displays: * // [ { id: 1, name: 'aze1' }, * // { id: 1, name: 'erg1' }, * // { id: 1, name: 'df1' } ] * // * // [ { id: 2, name: 'sf2' }, * // { id: 2, name: 'dg2' }, * // { id: 2, name: 'sfqfb2' }, * // { id: 2, name: 'qsgqsfg2' } ] * // * // [ { id: 3, name: 'qfs3' } ] * * @example <caption>Pivot data on the id field</caption> * Observable.of<Obj>({id: 1, name: 'aze1'}, * {id: 2, name: 'sf2'}, * {id: 2, name: 'dg2'}, * {id: 1, name: 'erg1'}, * {id: 1, name: 'df1'}, * {id: 2, name: 'sfqfb2'}, * {id: 3, name: 'qfs1'}, * {id: 2, name: 'qsgqsfg2'} * ) * .groupBy(p => p.id, p => p.name) * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key])) * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)})) * .subscribe(p => console.log(p)); * * // displays: * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] } * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] } * // { id: 3, values: [ 'qfs1' ] } * * @param {function(value: T): K} keySelector A function that extracts the key * for each item. * @param {function(value: T): R} [elementSelector] A function that extracts the * return element for each item. * @param {function(grouped: GroupedObservable<K,R>): Observable<any>} [durationSelector] * A function that returns an Observable to determine how long each group should * exist. * @return {Observable<GroupedObservable<K,R>>} An Observable that emits * GroupedObservables, each of which corresponds to a unique key value and each * of which emits those items from the source Observable that share that key * value. * @method groupBy * @owner Observable */ function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { return groupBy_1.groupBy(keySelector, elementSelector, durationSelector, subjectSelector)(this); } exports.groupBy = groupBy; //# sourceMappingURL=groupBy.js.map