Sha256: 0da54f92a4d6f212dedba4149fecd9838fdef798c81b595ac9c7a53260e8f8a8

Contents?: true

Size: 789 Bytes

Versions: 6

Compression:

Stored size: 789 Bytes

Contents

/*!
 * 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}
 * @namespace Utils
 * @name getProperties
 * @api public
 */

module.exports = function getProperties(object) {
  var result = Object.getOwnPropertyNames(object);

  function addProperty(property) {
    if (result.indexOf(property) === -1) {
      result.push(property);
    }
  }

  var proto = Object.getPrototypeOf(object);
  while (proto !== null) {
    Object.getOwnPropertyNames(proto).forEach(addProperty);
    proto = Object.getPrototypeOf(proto);
  }

  return result;
};

Version data entries

6 entries across 6 versions & 5 rubygems

Version Path
epuber-stylus-source-0.56.0 vendor/node_modules/chai/lib/chai/utils/getProperties.js
learn_create-0.0.22 lib/templates/javascript_lab_template/node_modules/chai/lib/chai/utils/getProperties.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/chai/lib/chai/utils/getProperties.js
locomotivecms-3.4.0 app/javascript/node_modules/chai/lib/chai/utils/getProperties.js
mdarray-sol-0.1.0-java node_modules/chai/lib/chai/utils/getProperties.js
select_all-rails-0.3.1 node_modules/chai/lib/chai/utils/getProperties.js