get-prototype-chain

1.0.1 • Public • Published

get-prototype-chain Build Status

Returns an array with the passed in object's prototype chain (in ascending order).

Install

npm install --save get-prototype-chain

Usage

const getPrototypeChain = require('get-prototype-chain');
 
class A {
 
}
 
class B extends A {
 
}
 
class C extends B {
 
}
 
var obj = new C();
 
getPrototypeChain(obj).map(x => x.constructor.name)
 
// returns ['C', 'C', 'B', 'A', 'Object']

Package Sidebar

Install

npm i get-prototype-chain

Weekly Downloads

60,961

Version

1.0.1

License

ISC

Last publish

Collaborators

  • leahcimic