Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
validateTag(value = null) {
return validation.validate(value, this.props.validateTags);
}
async validateAttribute(value: mixed) {
let validators = this.getValidators();
if (typeof validators === "string") {
try {
await validation.validate(value, validators);
} catch (e) {
throw new ModelError("Invalid attribute.", ModelError.INVALID_ATTRIBUTE, {
message: e.message,
value: e.value,
validator: e.validator
});
}
} else if (typeof validators === "function") {
await validators(value, this);
}
}
validateTag(value = null) {
if (typeof this.props.validate === "string") {
return validation.validate(value, this.props.validateTags);
}
}
async validateAttribute(value: mixed) {
let validators = this.getValidators();
if (typeof validators === "string") {
try {
await validation.validate(value, validators);
} catch (e) {
throw new ModelError("Invalid attribute.", ModelError.INVALID_ATTRIBUTE, {
message: e.message,
value: e.value,
validator: e.validator
});
}
} else if (typeof validators === "function") {
await validators(value, this);
}
}
validateTag(value = null) {
if (typeof this.props.validate === "string") {
return validation.validate(value, this.props.validateTags);
}
}