You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
YZY eef3e25414
branch149
1 year ago
..
.github branch149 1 year ago
test branch149 1 year ago
.eslintrc branch149 1 year ago
.nycrc branch149 1 year ago
CHANGELOG.md branch149 1 year ago
LICENSE branch149 1 year ago
Object.setPrototypeOf.d.ts branch149 1 year ago
Object.setPrototypeOf.js branch149 1 year ago
README.md branch149 1 year ago
Reflect.setPrototypeOf.d.ts branch149 1 year ago
Reflect.setPrototypeOf.js branch149 1 year ago
index.d.ts branch149 1 year ago
index.js branch149 1 year ago
package.json branch149 1 year ago
tsconfig.json branch149 1 year ago

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