1.0.0 • Published 8 years ago
@f/morph-obj v1.0.0
morph-obj
Morph an object so that it looks like another object
Installation
$ npm install @f/morph-obj
Usage
morphObj deletes all the properties of the old object and then sets all the properties of the new object on it, so that they are deep equal.
E.g. morph(a, b) // -> deepEqual(a, b)
var morph = require('@f/morph-obj')
function hotReloadComponent (old, new) {
morph(old, new)
forceUpdate()
}
API
morphObj(oldObj, newObj)
oldObj
- The object you want to make look likenewObj
newObj
- Properties will be copied fromnewObj
intooldObj
Returns: Returns and mutates oldObj
.
License
MIT
1.0.0
8 years ago