# proxy-assign

> Create proxy instead of Object.assign

Latest version **0.3.0** (published 2022-01-16) · 0 weekly downloads

## Install

```sh
npm install proxy-assign
pnpm add proxy-assign
yarn add proxy-assign
bun add proxy-assign
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2022-01-16 |
| First published | 2018-03-07 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | laggingreflex |

## Links

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

## Recent versions

- 0.3.0 (latest) — 2022-01-16
- 0.2.1 — 2022-01-14
- 0.2.0 — 2018-03-07
- 0.1.0 — 2018-03-07

## README

# proxy-assign

Creates [proxies][Proxy] of all existing properties of source object(s) onto a target object, without actually assigning anything onto the target.

In contrast to [Object.assign]:

> The `Object.assign()` method **[copies]** properties from a source object to a target object. **It uses `[[Get]]` on the source and `[[Set]]` on the target**.

This **doesn't copy** and uses **both** `[[Get]]` ***and*** `[[Set]]` on the **source** (for properties that exist on it).

Modifying exiting properties (even primitives) alters them on the source object. Any new properties are still set on the target.

[Proxy]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
[Object.assign]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Description

## Install

```
npm i proxy-assign
```

## Usage

### API

```js
const target = ProxyAssign(target, ...sources)
```

### Example

```js
const ProxyAssign = require('proxy-assign')

const source = { a: 'a' }
const target = {}
const proxy = ProxyAssign(target, source)

proxy.a = 0
proxy.b = 'b'
```
```js
source: { a: 0 }
target: { b: 'b' }
proxy: Proxy { b: 'b' } // Proxy of target
```

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