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.

23 lines
569 B

4 years ago
  1. var get = require('./get');
  2. /**
  3. * The base implementation of `_.at` without support for individual paths.
  4. *
  5. * @private
  6. * @param {Object} object The object to iterate over.
  7. * @param {string[]} paths The property paths to pick.
  8. * @returns {Array} Returns the picked elements.
  9. */
  10. function baseAt(object, paths) {
  11. var index = -1,
  12. length = paths.length,
  13. result = Array(length),
  14. skip = object == null;
  15. while (++index < length) {
  16. result[index] = skip ? undefined : get(object, paths[index]);
  17. }
  18. return result;
  19. }
  20. module.exports = baseAt;