defaults-deep icon indicating copy to clipboard operation
defaults-deep copied to clipboard

Custom validation callback

Open jhuliano opened this issue 9 years ago • 0 comments

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;
      }
  [...]
}

jhuliano avatar Feb 03 '17 14:02 jhuliano