Skip to content

Commit

Permalink
Merge branch 'master' of github.com:TehShrike/deepmerge
Browse files Browse the repository at this point in the history
  • Loading branch information
TehShrike committed Oct 28, 2019
2 parents c759b5d + d1ae60f commit e9c9fec
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,29 +209,29 @@ It may also return undefined, in which case the default merge behaviour will be

```js
const alex = {
name: {
first: 'Alex',
last: 'Alexson'
},
pets: ['Cat', 'Parrot']
name: {
first: 'Alex',
last: 'Alexson'
},
pets: ['Cat', 'Parrot']
}

const tony = {
name: {
first: 'Tony',
last: 'Tonison'
},
pets: ['Dog']
name: {
first: 'Tony',
last: 'Tonison'
},
pets: ['Dog']
}

const mergeNames = (nameA, nameB) => `${nameA.first} and ${nameB.first}`

const options = {
customMerge: (key) => {
if (key === 'name') {
return mergeNames
}
}
customMerge: (key) => {
if (key === 'name') {
return mergeNames
}
}
}

const result = merge(alex, tony, options)
Expand Down

0 comments on commit e9c9fec

Please sign in to comment.