Skip to content

Instantly share code, notes, and snippets.

@bttmly
Created June 15, 2014 20:48
Show Gist options
  • Save bttmly/79e8c657535b0d569ff2 to your computer and use it in GitHub Desktop.
Save bttmly/79e8c657535b0d569ff2 to your computer and use it in GitHub Desktop.
var getPrototypeChainOf = function( obj ) {
var chain = [];
if ( isFunction(obj) ) {
obj = obj.prototype;
} else {
obj = obj.constructor.prototype;
}
do {
chain.push( obj );
} while ( obj = Object.getPrototypeOf( obj ) )
return chain;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment