> npm install protochain
const protochain = require('protochain')protochain(123)
// => [Number.prototype, Object.prototype]
protochain('abc')
// => [String.prototype, Object.prototype]
protochain(/abc/)
// => [RegExp.prototype, Object.prototype]
protochain(true)
// => [Boolean.prototype, Object.prototype]
protochain(false)
// => [Boolean.prototype, Object.prototype]
protochain(NaN)
// => [Number.prototype, Object.prototype]protochain({})
// => [Object.prototype]
protochain(Object.create(null))
// => []
protochain(null)
// => []
protochain(undefined)
// => []
protochain()
// => []protochain(new Error('message'))
// => [Error.prototype, Object.prototype]
protochain(new TypeError('message'))
// => [TypeError.prototype, Error.prototype, Object.prototype]
class Person {}
class FancyPerson extends Person {}
protochain(new Person())
// => [Person.prototype, Object.prototype]
protochain(new FancyPerson())
// => [FancyPerson.prototype, Person.prototype, Object.prototype])function Person() {
}
function FancyPerson() {
Person.call(this)
}
FancyPerson.prototype = Object.create(Person.prototype)
protochain(new Person())
// => [Person.prototype, Object.prototype]
protochain(new FancyPerson())
// => [FancyPerson.prototype, Person.prototype, Object.prototype]protochain(Promise.resolve())
// => [Promise.prototype, Object.prototype]protochain(new Map())
// => [Map.prototype, Object.prototype]
protochain(new Set())
// => [Set.prototype, Object.prototype]
protochain(new WeakMap())
// => [WeakMap.prototype, Object.prototype]
protochain(new WeakSet())
// => [WeakSet.prototype, Object.prototype]Note: different hierarchy in newer JS engines.
protochain(new Int8Array())
// Newer Engines
// => [Int8Array.prototype, TypedArray.prototype, Object.prototype]
// Older Engines
// => [Int8Array.prototype, Object.prototype]MIT

