Skip to content

Commit

Permalink
Update documentation for string.trim([enabled])
Browse files Browse the repository at this point in the history
  • Loading branch information
rokoroku committed Jun 30, 2018
1 parent 0a82b61 commit 3414eb7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions API.md
Expand Up @@ -135,7 +135,7 @@
- [`string.normalize([form])`](#stringnormalizeform)
- [`string.lowercase()`](#stringlowercase)
- [`string.uppercase()`](#stringuppercase)
- [`string.trim()`](#stringtrim)
- [`string.trim([enabled])`](#stringtrimenabled)
- [`string.isoDate()`](#stringisodate)
- [`alternatives` - inherits from `Any`](#alternatives---inherits-from-any)
- [`alternatives.try(schemas)`](#alternativestryschemas)
Expand Down Expand Up @@ -2132,13 +2132,17 @@ will be forced to uppercase.
const schema = Joi.string().uppercase();
```

#### `string.trim()`
#### `string.trim([enabled])`

Requires the string value to contain no whitespace before or after. If the validation `convert` option is on (enabled by
default), the string will be trimmed.

Parameters are:
- `enabled` - optional parameter defaulting to `true` which allows you to reset the behavior of trim by providing a falsy value.

```js
const schema = Joi.string().trim();
const schema = Joi.string().trim(false); // disable trim flag
```

#### `string.isoDate()`
Expand Down

0 comments on commit 3414eb7

Please sign in to comment.