-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* chore: rename merge.js to merge.ts (#683) * chore: add type to deepmerge(#683) * chore: add FlowFixMe temporarily for files converted to TS (#683) * chore: add underscore in arg for unused param
- Loading branch information
1 parent
b49fe00
commit ed6205b
Showing
3 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import deepmerge from 'deepmerge'; | ||
|
||
/** | ||
* `deepmerge` concatenates arrays by default instead of overwriting them. | ||
* We define custom merging function for arrays to change that behaviour | ||
*/ | ||
export default function merge( | ||
x: Array<{[key: string]: any}>, | ||
y: Array<{[key: string]: any}>, | ||
) { | ||
return deepmerge(x, y, { | ||
arrayMerge: (_destinationArray: any[], sourceArray: any[]): any[] => | ||
sourceArray, | ||
}); | ||
} |