Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
changesetFor(modelName, model, options = {}) {
const validator = this.validatorFor(modelName, options);
let changeset;
if (validator) {
let validatorFunc = validator;
if (typeof validator !== 'function') {
validatorFunc = lookupValidator(validator);
}
changeset = createChangeset(model, validatorFunc, validator, { changeset: Changeset });
} else {
changeset = createChangeset(model);
}
return changeset;
}
const defaultChangeset = function(data, validators) {
return createChangeset(data, lookupValidator(validators), validators, { changeset: Changeset });
};
/**
changesetFor(modelName, model, options = {}) {
const validator = this.validatorFor(modelName, options);
let changeset;
if (validator) {
let validatorFunc = validator;
if (typeof validator !== 'function') {
validatorFunc = lookupValidator(validator);
}
changeset = createChangeset(model, validatorFunc, validator, { changeset: Changeset });
} else {
changeset = createChangeset(model);
}
return changeset;
}