morphit/node_modules/get-proto
2026-06-13 20:09:20 -07:00
..
.github Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
test Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
.eslintrc Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
.nycrc Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
CHANGELOG.md Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
index.d.ts Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
index.js Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
LICENSE Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
Object.getPrototypeOf.d.ts Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
Object.getPrototypeOf.js Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
package.json Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
README.md Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
Reflect.getPrototypeOf.d.ts Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
Reflect.getPrototypeOf.js Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00
tsconfig.json Morphit v1.0.0-beta.16 2026-06-13 20:09:20 -07:00

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