getEnumerableProperties.js 527 B

12345678910111213141516171819202122232425
  1. /*!
  2. * Chai - getEnumerableProperties utility
  3. * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
  4. * MIT Licensed
  5. */
  6. /**
  7. * ### .getEnumerableProperties(object)
  8. *
  9. * This allows the retrieval of enumerable property names of an object,
  10. * inherited or not.
  11. *
  12. * @param {Object} object
  13. * @returns {Array}
  14. * @name getEnumerableProperties
  15. * @api public
  16. */
  17. module.exports = function getEnumerableProperties(object) {
  18. var result = [];
  19. for (var name in object) {
  20. result.push(name);
  21. }
  22. return result;
  23. };