@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
25 lines (23 loc) • 620 B
JavaScript
import { map } from './map';
function plucker(props, length) {
const mapper = (x) => {
let currentProp = x;
for (let i = 0; i < length; i++) {
const p = currentProp[props[i]];
if (typeof p !== 'undefined') {
currentProp = p;
}
else {
return undefined;
}
}
return currentProp;
};
return mapper;
}
export function pluck(...args) {
return function pluckOperatorFunction(source) {
return (map(plucker(args, args.length)))(source);
};
}
//# sourceMappingURL=pluck.mjs.map