Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

set-proto

ljharb59.1mMIT1.0.0TypeScript support: included

Robustly set the [[Prototype]] of an object

set, proto, prototype, setPrototypeOf, [[Prototype]]

readme

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

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.0.0 - 2024-12-30

Commits