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.

34 regels
733 B

3 jaren geleden
  1. var baseValues = require('./_baseValues'),
  2. keys = require('./keys');
  3. /**
  4. * Creates an array of the own enumerable string keyed property values of `object`.
  5. *
  6. * **Note:** Non-object values are coerced to objects.
  7. *
  8. * @static
  9. * @since 0.1.0
  10. * @memberOf _
  11. * @category Object
  12. * @param {Object} object The object to query.
  13. * @returns {Array} Returns the array of property values.
  14. * @example
  15. *
  16. * function Foo() {
  17. * this.a = 1;
  18. * this.b = 2;
  19. * }
  20. *
  21. * Foo.prototype.c = 3;
  22. *
  23. * _.values(new Foo);
  24. * // => [1, 2] (iteration order is not guaranteed)
  25. *
  26. * _.values('hi');
  27. * // => ['h', 'i']
  28. */
  29. function values(object) {
  30. return object == null ? [] : baseValues(object, keys(object));
  31. }
  32. module.exports = values;