knowledgebase_law/node_modules/set-proto
2025-04-11 11:47:09 -04:00
..
.github Initial commit 2025-04-11 11:47:09 -04:00
test Initial commit 2025-04-11 11:47:09 -04:00
.eslintrc Initial commit 2025-04-11 11:47:09 -04:00
.nycrc Initial commit 2025-04-11 11:47:09 -04:00
CHANGELOG.md Initial commit 2025-04-11 11:47:09 -04:00
index.d.ts Initial commit 2025-04-11 11:47:09 -04:00
index.js Initial commit 2025-04-11 11:47:09 -04:00
LICENSE Initial commit 2025-04-11 11:47:09 -04:00
Object.setPrototypeOf.d.ts Initial commit 2025-04-11 11:47:09 -04:00
Object.setPrototypeOf.js Initial commit 2025-04-11 11:47:09 -04:00
package.json Initial commit 2025-04-11 11:47:09 -04:00
README.md Initial commit 2025-04-11 11:47:09 -04:00
Reflect.setPrototypeOf.d.ts Initial commit 2025-04-11 11:47:09 -04:00
Reflect.setPrototypeOf.js Initial commit 2025-04-11 11:47:09 -04:00
tsconfig.json Initial commit 2025-04-11 11:47:09 -04:00

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