seven c79d79ff8e 3333 há 2 dias atrás
..
.github c79d79ff8e 3333 há 2 dias atrás
test c79d79ff8e 3333 há 2 dias atrás
.eslintrc c79d79ff8e 3333 há 2 dias atrás
.nycrc c79d79ff8e 3333 há 2 dias atrás
CHANGELOG.md c79d79ff8e 3333 há 2 dias atrás
LICENSE c79d79ff8e 3333 há 2 dias atrás
Object.getPrototypeOf.d.ts c79d79ff8e 3333 há 2 dias atrás
Object.getPrototypeOf.js c79d79ff8e 3333 há 2 dias atrás
README.md c79d79ff8e 3333 há 2 dias atrás
Reflect.getPrototypeOf.d.ts c79d79ff8e 3333 há 2 dias atrás
Reflect.getPrototypeOf.js c79d79ff8e 3333 há 2 dias atrás
index.d.ts c79d79ff8e 3333 há 2 dias atrás
index.js c79d79ff8e 3333 há 2 dias atrás
package.json c79d79ff8e 3333 há 2 dias atrás
tsconfig.json c79d79ff8e 3333 há 2 dias atrás

README.md

get-proto Version Badge

github actions coverage License Downloads

npm badge

Robustly get the [[Prototype]] of an object. Uses the best available method.

Getting started

npm install --save get-proto

Usage/Examples

const assert = require('assert');
const getProto = require('get-proto');

const a = { a: 1, b: 2, [Symbol.toStringTag]: 'foo' };
const b = { c: 3, __proto__: a };

assert.equal(getProto(b), a);
assert.equal(getProto(a), Object.prototype);
assert.equal(getProto({ __proto__: null }), null);

Tests

Clone the repo, npm install, and run npm test