Replies: 1 comment 6 replies
-
I'm not sure how import { deepmergeCustom } from "deepmerge-ts";
export const myDeepmerge = deepmergeCustom({
mergeOthers: (values, utils, meta) => {
const objectToGetKeysOf = meta.parents[meta.parents.length - 1];
const keysToKeep = new Set([
...Object.keys(objectToGetKeysOf),
...Object.getOwnPropertySymbols(objectToGetKeysOf)
]);
if (!keysToKeep.has(meta.key)) {
return utils.actions.skip;
}
return utils.actions.defaultMerge;
}
}); import { myDeepmerge } from "./path/to/this/function";
const x = {
record: {
prop1: "value1",
prop2: "value2"
}
};
const y = {
record: {
prop1: "changed"
}
};
const result = myDeepmerge(x, y); |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Suggestion
How this can be done?
Beta Was this translation helpful? Give feedback.
All reactions