@c8/joi-validator-promised
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "@c8/joi-validator-promised", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "bluebird": "^3.3.5", |
@@ -14,3 +14,3 @@ # Validator | ||
} | ||
const validator = new Validator(opts) | ||
const myValidator = new Validator(opts) | ||
@@ -28,8 +28,13 @@ const joiSchema = { | ||
// Using the promise | ||
validator.validate(data, joiSchema).then((result) => { | ||
//do something | ||
}) | ||
myValidator.validate(data, joiSchema).then( | ||
(result) => { | ||
//do something | ||
}, | ||
(err) => { | ||
throw new Validator.ValidationError('A validation error occurred') | ||
} | ||
) | ||
// Validate Synchronously i.e. with the standard Joi validate method | ||
let result = validator.validateSync(data, joiSchema) | ||
let result = myValidator.validateSync(data, joiSchema) | ||
@@ -39,2 +44,4 @@ //If there is no error | ||
// Do something | ||
} else { | ||
throw new Validator.ValidationError('A validation error occurred') | ||
} | ||
@@ -41,0 +48,0 @@ ``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57815
48