npm.io
1.0.1 • Published 11 years ago

get-prototype-chain

Licence
ISC
Version
1.0.1
Deps
0
Vulns
0
Weekly
0
Stars
2

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']

Keywords