baseValues.js 593 B

12345678910111213141516171819202122
  1. /**
  2. * The base implementation of `_.values` and `_.valuesIn` which creates an
  3. * array of `object` property values corresponding to the property names
  4. * of `props`.
  5. *
  6. * @private
  7. * @param {Object} object The object to query.
  8. * @param {Array} props The property names to get values for.
  9. * @returns {Object} Returns the array of property values.
  10. */
  11. function baseValues(object, props) {
  12. var index = -1,
  13. length = props.length,
  14. result = Array(length);
  15. while (++index < length) {
  16. result[index] = object[props[index]];
  17. }
  18. return result;
  19. }
  20. module.exports = baseValues;