This commit is contained in:
mario
2025-03-11 13:16:07 +07:00
commit 3c64adc353
215 changed files with 111738 additions and 0 deletions

18
src/utils/combineMerge.ts Normal file
View File

@@ -0,0 +1,18 @@
import deepmerge from "deepmerge";
const combineMerge = (target, source, options) => {
const destination = target.slice();
source.forEach((item: object, index: number) => {
if (typeof destination[index] === 'undefined') {
destination[index] = options.cloneUnlessOtherwiseSpecified(item, options);
} else if (options.isMergeableObject(item)) {
destination[index] = deepmerge(target[index], item, options);
} else if (target.indexOf(item) === -1) {
destination.push(item);
}
});
return destination;
};
export default combineMerge;