Sha256: 0f3d6c1db80fb7d79fc65149f6d92172349126054d7365ace6253d44f4e3f151

Contents?: true

Size: 771 Bytes

Versions: 8

Compression:

Stored size: 771 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}
 * @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;
};

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ende-0.5.22 components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js
ende-0.5.21 components/indefinido/indemma/master/components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js
ende-0.5.6 components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js
ende-0.5.5 components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js
ende-0.5.4 components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js
ende-0.5.3 components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js
ende-0.5.2 components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js
ende-0.5.1 components/chaijs/chai/1.9.1/lib/chai/utils/getProperties.js