get-prototype-chain

Returns an array of the object's prototype chain

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
get-prototype-chain
201.0.18 years ago8 years agoMinified + gzip package size for get-prototype-chain in KB

Readme

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