[CI Skip] 0.6.4
This commit is contained in:
@@ -14,6 +14,24 @@ Utility methods for this package are split into groups
|
||||
|
||||
# Available methods
|
||||
|
||||
## assert
|
||||
|
||||
Checks for a valid test, if not ExtError is thrown.
|
||||
|
||||
```js
|
||||
assert (test: boolean, message: string, code: number = ExtError.CODES.ASSERT, data: any): void
|
||||
```
|
||||
|
||||
|
||||
Checks that `test` is a true value. If value is `false` (or `false-ish`), it throws an ExtError with the supplied `message` and an optional `code` and `data`. When `test` passes, `true` is returned.
|
||||
|
||||
```js
|
||||
const assert = require('@polkadot/util/assert');
|
||||
|
||||
assert(true === true, 'True should be true'); // true returned
|
||||
assert(false === true, 'False should not be true'); // ExtError thrown
|
||||
```
|
||||
|
||||
## Logger
|
||||
|
||||
Creates a consistent log interface for messages
|
||||
|
||||
Reference in New Issue
Block a user