1.0.0 • Published 8 years ago

@f/morph-obj v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

morph-obj

Build status Git tag NPM version Code style

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 like newObj
  • newObj - Properties will be copied from newObj into oldObj

Returns: Returns and mutates oldObj.

License

MIT