Update readme.md
This commit is contained in:
parent
7a397c996f
commit
0ead3e6840
1 changed files with 3 additions and 3 deletions
|
|
@ -45,13 +45,13 @@ assert.string(2);
|
||||||
//=> Error: Expected value which is `string`, received value of type `number`.
|
//=> Error: Expected value which is `string`, received value of type `number`.
|
||||||
```
|
```
|
||||||
|
|
||||||
Most assertions also support an optional custom error message.
|
Assertions (except `assertAll` and `assertAny`) also support an optional custom error message.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import {assert} from '@sindresorhus/is';
|
import {assert} from '@sindresorhus/is';
|
||||||
|
|
||||||
assert.nonEmptyString(process.env.API_URL, 'API_URL env variable is required.');
|
assert.nonEmptyString(process.env.API_URL, 'The API_URL environment variable is required.');
|
||||||
//=> Error: API_URL env variable is required.
|
//=> Error: The API_URL environment variable is required.
|
||||||
```
|
```
|
||||||
|
|
||||||
And with TypeScript:
|
And with TypeScript:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue