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