1a6d0bc23ff4368df6f5703d79d8e74642b78cd4c128a5e729a187a0c4134119922a276f6ec1c0e3b55de9502747c0cbc78978275cd7bc217a0a96a5708eed 755 B

12345678910111213141516171819202122232425
  1. import { map } from './map';
  2. export function pluck() {
  3. var properties = [];
  4. for (var _i = 0; _i < arguments.length; _i++) {
  5. properties[_i] = arguments[_i];
  6. }
  7. var length = properties.length;
  8. if (length === 0) {
  9. throw new Error('list of properties cannot be empty.');
  10. }
  11. return map(function (x) {
  12. var currentProp = x;
  13. for (var i = 0; i < length; i++) {
  14. var p = currentProp === null || currentProp === void 0 ? void 0 : currentProp[properties[i]];
  15. if (typeof p !== 'undefined') {
  16. currentProp = p;
  17. }
  18. else {
  19. return undefined;
  20. }
  21. }
  22. return currentProp;
  23. });
  24. }
  25. //# sourceMappingURL=pluck.js.map