# safe-object-assign

> Make Object.assign() safer for values and objects.

Latest version **0.0.11** (published 2020-11-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install safe-object-assign
pnpm add safe-object-assign
yarn add safe-object-assign
bun add safe-object-assign
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.11 |
| Published | 2020-11-20 |
| First published | 2020-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | dfkaye |
| Maintainers | dfkaye |
| Keywords | object.assign, safe-assign |

## Links

- npm: https://www.npmjs.com/package/safe-object-assign
- Repository: https://github.com/dfkaye/safe-assign
- Homepage: https://github.com/dfkaye/safe-assign#readme
- Issues: https://github.com/dfkaye/safe-assign/issues
- npm.io page: https://npm.io/package/safe-object-assign

## Recent versions

- 0.0.11 (latest) — 2020-11-20
- 0.0.10 — 2020-11-20
- 0.0.9 — 2020-11-20
- 0.0.8 — 2020-11-20
- 0.0.7 — 2020-11-20
- 0.0.6 — 2020-11-20
- 0.0.5 — 2020-11-20
- 0.0.4 — 2020-11-19
- 0.0.3 — 2020-11-19
- 0.0.2 — 2020-11-19
- 0.0.1 — 2020-11-19

## README

# safe-object-assign

Sensible wrapper for `Object.assign()`.

## Documentation

`Object.assign()` can return surprising results when a value to be modified is not an object. 

The point of `safe-object-assign` is to allow users to pass anything,

1. without blowing up,
2. retain the initial value if it is not an object or array,
3. obtain a modified copy of the initial object or array to be updated,
4. mixing only objects or arrays into the new model.

See full details on my blog post at https://dfkaye.com/posts/2020/08/21/safer-object.assign-operations-using-a-sensible-wrapper/

## Install

`npm install safe-object-assign`

**OR**

`git clone https://github.com/dfkaye/safer-object-assign.git`

## Test

Install dependencies (mocha and chai): `npm install safe-object-assign --save-dev`

Run: `npm test`

**OR**

Visit the live demo running the browser test suite on my blog:
https://dfkaye.com/demos/safe-assign-test-suite/.

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