defaults-deep
defaults-deep copied to clipboard
Custom validation callback
Hello, If found this package pretty useful but the "missing" criteria doesn't match with my needs. So I would propose (as a new feature) having a custom, optional, callback as the last parameter so the user can modify this at his will.
It could look something like this (3 lines change):
function defaultsDeep(target, objects, isMissing) {
target = target || {};
isMissing = isMissing || ((val) => val == null);
[...]
if (isMissing(val)) {
target[key] = value;
}
[...]
}