keysIn.js 869 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import _curry1 from "./internal/_curry1.js";
  2. /**
  3. * Returns a list containing the names of all the properties of the supplied
  4. * object, including prototype properties.
  5. * Note that the order of the output array is not guaranteed to be consistent
  6. * across different JS platforms.
  7. *
  8. * @func
  9. * @memberOf R
  10. * @since v0.2.0
  11. * @category Object
  12. * @sig {k: v} -> [k]
  13. * @param {Object} obj The object to extract properties from
  14. * @return {Array} An array of the object's own and prototype properties.
  15. * @see R.keys, R.valuesIn
  16. * @example
  17. *
  18. * const F = function() { this.x = 'X'; };
  19. * F.prototype.y = 'Y';
  20. * const f = new F();
  21. * R.keysIn(f); //=> ['x', 'y']
  22. */
  23. var keysIn =
  24. /*#__PURE__*/
  25. _curry1(function keysIn(obj) {
  26. var prop;
  27. var ks = [];
  28. for (prop in obj) {
  29. ks[ks.length] = prop;
  30. }
  31. return ks;
  32. });
  33. export default keysIn;