Skip to content

Commit

Permalink
Update API.md - correct sample - fails because is gone
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Mar 12, 2020
1 parent b0ab57c commit c4d072b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,10 @@ schema.validate({ foo: -2 }); // returns new Error('"foo" requires a positive
const schema = Joi.object({
foo: Joi.number().min(0).error((errors) => {

return new Error('found errors with ' + errors.map((err) => `${err.type}(${err.local.limit}) with value ${err.local.value}`).join(' and '));
return new Error('found errors with ' + errors.map((err) => `${err.local.key}(${err.local.limit}) with value ${err.local.value}`).join(' and '));
})
});
schema.validate({ foo: -2 }); // returns new Error('child "foo" fails because [found errors with number.min(0) with value -2]')
schema.validate({ foo: -2 }); // returns new Error('found errors with foo(0) with value -2')
```

#### `any.example(example, [options])`
Expand Down

0 comments on commit c4d072b

Please sign in to comment.