0.2.1 • Published 1 year ago

proxy-merged v0.2.1

Weekly downloads
8
License
-
Repository
-
Last release
1 year ago

Proxy merged

Proxy merged is a tool for merging objects together using a proxy.

Usage

import proxyMerged from 'proxy-merged'
const a = { a: 1 }
const b = { b: 1 }
const merged = proxyMerged(a, b)

// merged can ge asked about props on its constituents
console.log('a:', merged.a, 'b:', merged.b)

// props not found in any of the sources is undefined
console.log('c:', merged.c)

// the merged object is mutable
merged.a = 'A' // changes a.a to A
merged.b = 'B' // changes b.b to B
merged.c = 'C' // when none of the sources have a prop, the change is performed on the first one given (a in this case)
console.log(a) // => {a:'A', c: 'C'}
console.log(b) // => {b:'B'}
0.2.1

1 year ago

0.3.0

2 years ago

0.2.0

4 years ago

0.1.0

4 years ago