|
|
1 周之前 | |
|---|---|---|
| .. | ||
| .github | 1 周之前 | |
| test | 1 周之前 | |
| .eslintrc | 1 周之前 | |
| .nycrc | 1 周之前 | |
| CHANGELOG.md | 1 周之前 | |
| LICENSE | 1 周之前 | |
| Object.setPrototypeOf.d.ts | 1 周之前 | |
| Object.setPrototypeOf.js | 1 周之前 | |
| README.md | 1 周之前 | |
| Reflect.setPrototypeOf.d.ts | 1 周之前 | |
| Reflect.setPrototypeOf.js | 1 周之前 | |
| index.d.ts | 1 周之前 | |
| index.js | 1 周之前 | |
| package.json | 1 周之前 | |
| tsconfig.json | 1 周之前 | |
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