|
пре 2 месеци | |
---|---|---|
.. | ||
.github | пре 2 месеци | |
test | пре 2 месеци | |
.eslintrc | пре 2 месеци | |
.nycrc | пре 2 месеци | |
CHANGELOG.md | пре 2 месеци | |
LICENSE | пре 2 месеци | |
Object.setPrototypeOf.d.ts | пре 2 месеци | |
Object.setPrototypeOf.js | пре 2 месеци | |
README.md | пре 2 месеци | |
Reflect.setPrototypeOf.d.ts | пре 2 месеци | |
Reflect.setPrototypeOf.js | пре 2 месеци | |
index.d.ts | пре 2 месеци | |
index.js | пре 2 месеци | |
package.json | пре 2 месеци | |
tsconfig.json | пре 2 месеци |
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