property-names

1.0.0 • Public • Published

property-names

Get all property names of an object including those in the prototype chain

installation

// npm
$ npm install property-names

usage

var getAllPropertyNames = require('property-names');

var Thing = function(){};
Thing.prototype.describe = function(){};

var Vehicle = function(){};
Vehicle.prototype = Object.create(Thing.prototype);
Vehicle.prototype.drive = function(){};
Vehicle.prototype.describe = function(){};

var Car = function( brand ){ this.brand = brand; };
Car.prototype = Object.create(Vehicle.prototype);

getAllPropertyNames(new Car()); // [ 'brand', 'drive', 'describe' ]

License

MIT

Package Sidebar

Install

npm i property-names

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • thomas-jensen