Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (isObject(error)) {
let errorLike /*: ErrLike<*> */ = (error /*: any */);
assert('Error must have value.', errorLike.hasOwnProperty('value'));
assert('Error must have validation.', errorLike.hasOwnProperty('validation'));
newError = new Err(errorLike.value, errorLike.validation);
} else {
let validation /*: ValidationErr */ = (error /*: any */);
newError = new Err(get(this, key), validation);
}
// Remove `key` from changes map.
let c = (this /*: ChangesetDef */);
// Add `key` to errors map.
let errors /*: Errors */ = get(this, ERRORS);
setNestedProperty(errors, key, newError);
c.notifyPropertyChange(ERRORS);
// Notify that `key` has changed.
c.notifyPropertyChange(key);
// Return passed-in `error`.
return error;
},
keys(obj).forEach(key =>
setNestedProperty(finalObj, key, obj[key])
)