0225304 479b0dd372 fit:first 1 주 전
..
.github 479b0dd372 fit:first 1 주 전
test 479b0dd372 fit:first 1 주 전
.eslintrc 479b0dd372 fit:first 1 주 전
.nycrc 479b0dd372 fit:first 1 주 전
CHANGELOG.md 479b0dd372 fit:first 1 주 전
LICENSE 479b0dd372 fit:first 1 주 전
Object.getPrototypeOf.d.ts 479b0dd372 fit:first 1 주 전
Object.getPrototypeOf.js 479b0dd372 fit:first 1 주 전
README.md 479b0dd372 fit:first 1 주 전
Reflect.getPrototypeOf.d.ts 479b0dd372 fit:first 1 주 전
Reflect.getPrototypeOf.js 479b0dd372 fit:first 1 주 전
index.d.ts 479b0dd372 fit:first 1 주 전
index.js 479b0dd372 fit:first 1 주 전
package.json 479b0dd372 fit:first 1 주 전
tsconfig.json 479b0dd372 fit:first 1 주 전

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