# set-proto

> Robustly set the [[Prototype]] of an object

Latest version **1.0.0** (published 2024-12-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install set-proto
pnpm add set-proto
yarn add set-proto
bun add set-proto
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-12-30 |
| First published | 2024-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 0.4 |
| Dependencies | 3 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jordan Harband |
| Maintainers | ljharb |
| Keywords | set, proto, prototype, setPrototypeOf, [[Prototype]] |

## Links

- npm: https://www.npmjs.com/package/set-proto
- Repository: https://github.com/ljharb/set-proto
- Homepage: https://github.com/ljharb/set-proto#readme
- Issues: https://github.com/ljharb/set-proto/issues
- npm.io page: https://npm.io/package/set-proto

## Dependencies (3)

- [es-errors](https://npm.io/package/es-errors.md) ^1.3.0
- [dunder-proto](https://npm.io/package/dunder-proto.md) ^1.0.1
- [es-object-atoms](https://npm.io/package/es-object-atoms.md) ^1.0.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2024-12-30

## README

# set-proto <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]

[![npm badge][npm-badge-png]][package-url]

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

## Getting started

```sh
npm install --save set-proto
```

## Usage/Examples

```js
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`

[package-url]: https://npmjs.org/package/set-proto
[npm-version-svg]: https://versionbadg.es/ljharb/set-proto.svg
[deps-svg]: https://david-dm.org/ljharb/set-proto.svg
[deps-url]: https://david-dm.org/ljharb/set-proto
[dev-deps-svg]: https://david-dm.org/ljharb/set-proto/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/set-proto#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/set-proto.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/set-proto.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/set-proto.svg
[downloads-url]: https://npm-stat.com/charts.html?package=set-proto
[codecov-image]: https://codecov.io/gh/ljharb/set-proto/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/set-proto/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-proto
[actions-url]: https://github.com/ljharb/set-proto/actions

---
_Source: https://npm.io/package/set-proto · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
