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
4 months ago
..
.github branch149 4 months ago
test branch149 4 months ago
.eslintrc branch149 4 months ago
.nycrc branch149 4 months ago
CHANGELOG.md branch149 4 months ago
LICENSE branch149 4 months ago
Object.setPrototypeOf.d.ts branch149 4 months ago
Object.setPrototypeOf.js branch149 4 months ago
README.md branch149 4 months ago
Reflect.setPrototypeOf.d.ts branch149 4 months ago
Reflect.setPrototypeOf.js branch149 4 months ago
index.d.ts branch149 4 months ago
index.js branch149 4 months ago
package.json branch149 4 months ago
tsconfig.json branch149 4 months 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