hz-zhhq-web/node_modules/set-proto
zzyuan 01c6571b37 前端提交5 2025-02-25 13:47:09 +08:00
..
.github 前端提交5 2025-02-25 13:47:09 +08:00
test 前端提交5 2025-02-25 13:47:09 +08:00
.eslintrc 前端提交5 2025-02-25 13:47:09 +08:00
.nycrc 前端提交5 2025-02-25 13:47:09 +08:00
CHANGELOG.md 前端提交5 2025-02-25 13:47:09 +08:00
LICENSE 前端提交5 2025-02-25 13:47:09 +08:00
Object.setPrototypeOf.d.ts 前端提交5 2025-02-25 13:47:09 +08:00
Object.setPrototypeOf.js 前端提交5 2025-02-25 13:47:09 +08:00
README.md 前端提交5 2025-02-25 13:47:09 +08:00
Reflect.setPrototypeOf.d.ts 前端提交5 2025-02-25 13:47:09 +08:00
Reflect.setPrototypeOf.js 前端提交5 2025-02-25 13:47:09 +08:00
index.d.ts 前端提交5 2025-02-25 13:47:09 +08:00
index.js 前端提交5 2025-02-25 13:47:09 +08:00
package.json 前端提交5 2025-02-25 13:47:09 +08:00
tsconfig.json 前端提交5 2025-02-25 13:47:09 +08:00

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