values.js 839 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import _curry1 from "./internal/_curry1.js";
  2. import keys from "./keys.js";
  3. /**
  4. * Returns a list of all the enumerable own properties of the supplied object.
  5. * Note that the order of the output array is not guaranteed across different
  6. * JS platforms.
  7. *
  8. * @func
  9. * @memberOf R
  10. * @since v0.1.0
  11. * @category Object
  12. * @sig {k: v} -> [v]
  13. * @param {Object} obj The object to extract values from
  14. * @return {Array} An array of the values of the object's own properties.
  15. * @see R.valuesIn, R.keys, R.toPairs
  16. * @example
  17. *
  18. * R.values({a: 1, b: 2, c: 3}); //=> [1, 2, 3]
  19. */
  20. var values =
  21. /*#__PURE__*/
  22. _curry1(function values(obj) {
  23. var props = keys(obj);
  24. var len = props.length;
  25. var vals = [];
  26. var idx = 0;
  27. while (idx < len) {
  28. vals[idx] = obj[props[idx]];
  29. idx += 1;
  30. }
  31. return vals;
  32. });
  33. export default values;