mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-21 15:25:09 +00:00
35 lines
771 B
JavaScript
35 lines
771 B
JavaScript
/*!
|
|
* Chai - getProperties utility
|
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
* MIT Licensed
|
|
*/
|
|
|
|
/**
|
|
* ### .getProperties(object)
|
|
*
|
|
* This allows the retrieval of property names of an object, enumerable or not,
|
|
* inherited or not.
|
|
*
|
|
* @param {Object} object
|
|
* @returns {Array}
|
|
* @name getProperties
|
|
* @api public
|
|
*/
|
|
|
|
module.exports = function getProperties(object) {
|
|
var result = Object.getOwnPropertyNames(subject);
|
|
|
|
function addProperty(property) {
|
|
if (result.indexOf(property) === -1) {
|
|
result.push(property);
|
|
}
|
|
}
|
|
|
|
var proto = Object.getPrototypeOf(subject);
|
|
while (proto !== null) {
|
|
Object.getOwnPropertyNames(proto).forEach(addProperty);
|
|
proto = Object.getPrototypeOf(proto);
|
|
}
|
|
|
|
return result;
|
|
};
|