nodejs-model
nodejs-model copied to clipboard
README.md has invalid sample code for validations
Took a minute to figure out why I couldn't get validations working based on the sample, but it looks like the sample code has a bug with the validation promise.
It displays this u1.validate(function() {})
:
u1.validate(function() {
if u1.isValid {
//validated, perform business logic
} else {
//validation failed, dump validation errors to the console
console.log(p1.errors)
}
});
When it should call u1.validate().then(function() {})
from the validate promise:
u1.validate().then(function() {
if u1.isValid {
//validated, perform business logic
} else {
//validation failed, dump validation errors to the console
console.log(p1.errors)
}
});
Thanks, Matt