Skip to content

Commit

Permalink
Merge pull request #1621 from johannesschobel/patch-1
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
Marsup committed Nov 11, 2018
2 parents cebb4f3 + 6b3a6c4 commit 6e9581e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -71,17 +71,17 @@ const schema = {
Note that **joi** schema objects are immutable which means every additional rule added (e.g. `.min(5)`) will return a
new schema object.

Then the value is validated against the schema:
Second, the value is validated against the defined schema:

```javascript
const {error, value} = Joi.validate({ a: 'a string' }, schema);

// or

Joi.validate({ a: 'a string' }, schema, function (err, value) { });
Joi.validate({ a: 'a string' }, schema, function (error, value) { });
```

If the input is valid, then the error will be `null`, otherwise it will be an Error object.
If the input is valid, then the `error` will be `null`, otherwise it will be an `Error` object providing more information.

The schema can be a plain JavaScript object where every key is assigned a **joi** type, or it can be a **joi** type directly:

Expand Down

0 comments on commit 6e9581e

Please sign in to comment.