Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pluck.js 880B

123456789101112131415161718192021222324252627282930
  1. /** PURE_IMPORTS_START _map PURE_IMPORTS_END */
  2. import { map } from './map';
  3. export function pluck() {
  4. var properties = [];
  5. for (var _i = 0; _i < arguments.length; _i++) {
  6. properties[_i] = arguments[_i];
  7. }
  8. var length = properties.length;
  9. if (length === 0) {
  10. throw new Error('list of properties cannot be empty.');
  11. }
  12. return function (source) { return map(plucker(properties, length))(source); };
  13. }
  14. function plucker(props, length) {
  15. var mapper = function (x) {
  16. var currentProp = x;
  17. for (var i = 0; i < length; i++) {
  18. var p = currentProp[props[i]];
  19. if (typeof p !== 'undefined') {
  20. currentProp = p;
  21. }
  22. else {
  23. return undefined;
  24. }
  25. }
  26. return currentProp;
  27. };
  28. return mapper;
  29. }
  30. //# sourceMappingURL=pluck.js.map