diff --git a/readme.md b/readme.md index 527745a..7bbaacf 100644 --- a/readme.md +++ b/readme.md @@ -45,6 +45,15 @@ assert.string(2); //=> Error: Expected value which is `string`, received value of type `number`. ``` +Most assertions also support an optional custom error message. + +```js +import {assert} from '@sindresorhus/is'; + +assert.nonEmptyString(process.env.API_URL, 'API_URL env variable is required.'); +//=> Error: API_URL env variable is required. +``` + And with TypeScript: ```ts