|
hai 3 semanas | |
---|---|---|
.. | ||
.github | hai 3 semanas | |
test | hai 3 semanas | |
.eslintrc | hai 3 semanas | |
.nycrc | hai 3 semanas | |
CHANGELOG.md | hai 3 semanas | |
LICENSE | hai 3 semanas | |
Object.setPrototypeOf.d.ts | hai 3 semanas | |
Object.setPrototypeOf.js | hai 3 semanas | |
README.md | hai 3 semanas | |
Reflect.setPrototypeOf.d.ts | hai 3 semanas | |
Reflect.setPrototypeOf.js | hai 3 semanas | |
index.d.ts | hai 3 semanas | |
index.js | hai 3 semanas | |
package.json | hai 3 semanas | |
tsconfig.json | hai 3 semanas |
Robustly set the [[Prototype]] of an object. Uses the best available method.
npm install --save set-proto
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);
Clone the repo, npm install
, and run npm test