source: trip-planner-front/node_modules/rxjs/internal/operators/pluck.js

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

initial commit

  • Property mode set to 100644
File size: 953 bytes
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var map_1 = require("./map");
4function pluck() {
5 var properties = [];
6 for (var _i = 0; _i < arguments.length; _i++) {
7 properties[_i] = arguments[_i];
8 }
9 var length = properties.length;
10 if (length === 0) {
11 throw new Error('list of properties cannot be empty.');
12 }
13 return function (source) { return map_1.map(plucker(properties, length))(source); };
14}
15exports.pluck = pluck;
16function plucker(props, length) {
17 var mapper = function (x) {
18 var currentProp = x;
19 for (var i = 0; i < length; i++) {
20 var p = currentProp != null ? currentProp[props[i]] : undefined;
21 if (p !== void 0) {
22 currentProp = p;
23 }
24 else {
25 return undefined;
26 }
27 }
28 return currentProp;
29 };
30 return mapper;
31}
32//# sourceMappingURL=pluck.js.map
Note: See TracBrowser for help on using the repository browser.