tree: d8d21dac4f7c6763820c3ee5923cd6929f3745b3 [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.setPrototypeOf.d.ts
  10. Object.setPrototypeOf.js
  11. package.json
  12. README.md
  13. Reflect.setPrototypeOf.d.ts
  14. Reflect.setPrototypeOf.js
  15. tsconfig.json
node_modules/set-proto/README.md

set-proto Version Badge

github actions coverage License Downloads

npm badge

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

Getting started

npm install --save set-proto

Usage/Examples

const assert = require('assert');
const setProto = require('set-proto');

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

assert.ok(!('c' in a));

setProto(a, b);

assert.ok('c' in a);

Tests

Clone the repo, npm install, and run npm test