1.0.0 • Published 9 years ago

super-merge v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

super-merge

Installation

$ npm install super-merge --save

Usage

import superMerge from 'super-merge'

const target = {
  str: 'string',
  obj: {
    nl: null,
    bool: true,
    arr: [ ]
  },
  arr: [
    {
      bool: true,
      str: 'string'
    },
    {
      numb: 5,
      obj: { },
      str: 'string'
    }
  ]
}

const receive = {
  str: null,
  obj: {
    bool: {
      num: 5
    }
  },
  arr: [
    'string',
    {
      obj: {
        bool: true
      }
    }
  ]
}

superMerge(target, receive)

/*
// target
{
  str: null,
  obj: {
    nl: null,
    bool: {
      num: 5
    },
    arr: [ ]
  },
  arr: [
    'string',
    {
      numb: 5,
      obj: {
        bool: true
      },
      str: 'string'
    }
  ]
}
*/

See also

Wiz Khalifa - Got Me Some More