source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/pluck.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 725 bytes
Line 
1import { map } from './map';
2export function pluck(...properties) {
3 const length = properties.length;
4 if (length === 0) {
5 throw new Error('list of properties cannot be empty.');
6 }
7 return (source) => map(plucker(properties, length))(source);
8}
9function plucker(props, length) {
10 const mapper = (x) => {
11 let currentProp = x;
12 for (let i = 0; i < length; i++) {
13 const p = currentProp != null ? currentProp[props[i]] : undefined;
14 if (p !== void 0) {
15 currentProp = p;
16 }
17 else {
18 return undefined;
19 }
20 }
21 return currentProp;
22 };
23 return mapper;
24}
25//# sourceMappingURL=pluck.js.map
Note: See TracBrowser for help on using the repository browser.