tree: 5d22702459874381510a62af14749f429c9f7f52 [path history] [tgz]
  1. .github/
  2. test/
  3. .eslintrc
  4. .nycrc
  5. CHANGELOG.md
  6. index.d.ts
  7. index.js
  8. LICENSE
  9. Object.getPrototypeOf.d.ts
  10. Object.getPrototypeOf.js
  11. package.json
  12. README.md
  13. Reflect.getPrototypeOf.d.ts
  14. Reflect.getPrototypeOf.js
  15. tsconfig.json
node_modules/get-proto/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