1.0.0 • Published 10 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-objUsage
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 likenewObjnewObj- Properties will be copied fromnewObjintooldObj
Returns: Returns and mutates oldObj.
License
MIT
1.0.0
10 years ago