_baseAt.js 569 B

1234567891011121314151617181920212223
  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;