Forked from mosesoak/Lodash deep merge with unique-value arrays
Created
September 13, 2022 16:51
-
-
Save steinathan/0e077c438f20d8ed6aef5420bc9b424f to your computer and use it in GitHub Desktop.
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
// Deep-merges arrays without duplicate values | |
const mergeCustomizer = (objValue: any, srcValue: any) => { | |
if (Array.isArray(objValue) && Array.isArray(srcValue)) { | |
return uniqWith( | |
[...srcValue, ...objValue], | |
(a, b) => a === b || isEqual(a, b), | |
); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment