/node_modules/lodash/values.js

https://bitbucket.org/coleman333/smartsite · JavaScript · 34 lines · 6 code · 2 blank · 26 comment · 1 complexity · 897424c6904ef8834bf0817a05d8a5c7 MD5 · raw file

  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;