UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

25 lines (23 loc) 638 B
import { MapIterable } 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 new MapIterable(source, plucker(args, args.length)); }; } //# sourceMappingURL=pluck.mjs.map