Posbridge/node_modules/get-proto
mehranz dbff17ac8e initial commit 2025-11-15 13:31:03 +03:30
..
.github initial commit 2025-11-15 13:31:03 +03:30
test initial commit 2025-11-15 13:31:03 +03:30
.eslintrc initial commit 2025-11-15 13:31:03 +03:30
.nycrc initial commit 2025-11-15 13:31:03 +03:30
CHANGELOG.md initial commit 2025-11-15 13:31:03 +03:30
LICENSE initial commit 2025-11-15 13:31:03 +03:30
Object.getPrototypeOf.d.ts initial commit 2025-11-15 13:31:03 +03:30
Object.getPrototypeOf.js initial commit 2025-11-15 13:31:03 +03:30
README.md initial commit 2025-11-15 13:31:03 +03:30
Reflect.getPrototypeOf.d.ts initial commit 2025-11-15 13:31:03 +03:30
Reflect.getPrototypeOf.js initial commit 2025-11-15 13:31:03 +03:30
index.d.ts initial commit 2025-11-15 13:31:03 +03:30
index.js initial commit 2025-11-15 13:31:03 +03:30
package.json initial commit 2025-11-15 13:31:03 +03:30
tsconfig.json initial commit 2025-11-15 13:31:03 +03:30

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