collect-property

0.1.1 • Public • Published

collect-property

Build Status Dependency Status devDependency Status

Collect property over prototype chain.

Install

Download manually or with package-manager.

npm

npm install --save collect-property

Example

var collectProperty = require('collect-property');
 
// Define constructors with following hierarchy: C -> B -> A
var A = function () {
  this.prop = 'baz';
};
var B = function () {
  this.prop = 'bar';
};
B.prototype = new A();
var C = function () {
  this.prop = 'foo';
};
C.prototype = new B();
 
// Create an instance.
var o = new C();
 
// Collect all values for the `prop` property.
var values = collectProperty(o, 'prop');
// → ['foo', 'bar', 'baz']

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Julien Fontanet

Package Sidebar

Install

npm i collect-property

Weekly Downloads

3

Version

0.1.1

License

ISC

Last publish

Collaborators

  • julien-f
  • marsaud