Skip to content

Commit

Permalink
Adding a note about how to avoid merging arrays
Browse files Browse the repository at this point in the history
Prompted by @adamreisnz's request #24 (comment)
  • Loading branch information
TehShrike authored Aug 17, 2017
1 parent e66e9b3 commit 1a84d4d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ function concatMerge(destinationArray, sourceArray, options) {
merge([1, 2, 3], [3, 2, 1], { arrayMerge: concatMerge }) // => [1, 2, 3, 3, 2, 1]
```

To prevent arrays from being merged:

```js
const dontMerge = (destination, source) => source
const output = deepMerge(destination, source, { arrayMerge: dontMerge })
```

#### clone

Defaults to `false`. If `clone` is `true` then both `x` and `y` are recursively cloned as part of the merge.
Expand Down

0 comments on commit 1a84d4d

Please sign in to comment.