๐Ÿ“ฆ ljharb / set-proto

Robustly set the [[Prototype]] of an object. Uses the best available method.

โ˜… 1 stars โ‘‚ 1 forks ๐Ÿ‘ 1 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/ljharb/set-proto.git
HTTPS git clone https://github.com/ljharb/set-proto.git
SSH git clone git@github.com:ljharb/set-proto.git
CLI gh repo clone ljharb/set-proto
Jordan Harband Jordan Harband [readme] replace runkit CI badge with shields.io check-runs badge 9b494eb 7 days ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ test
๐Ÿ“„ .eslintrc
๐Ÿ“„ .gitignore
๐Ÿ“„ .npmrc
๐Ÿ“„ .nycrc
๐Ÿ“„ CHANGELOG.md
๐Ÿ“„ index.d.ts
๐Ÿ“„ index.js
๐Ÿ“„ LICENSE
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ tsconfig.json
๐Ÿ“„ 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