[CI Skip] 0.32.8
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **arrayFilter**(array: *`Array`<`any`>*, allowNulls?: *`boolean`*): `Array`<`any`>
|
||||
|
||||
*Defined in [array/filter.ts:24](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/array/filter.ts#L24)*
|
||||
*Defined in [array/filter.ts:24](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/array/filter.ts#L24)*
|
||||
|
||||
*__name__*: arrayFilter
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Returns a new array with all `undefined` values removed. Optionally, when `allowNulls = false`, it removes the `null` values as well
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { arrayFilter } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **assert**(test: *`any`*, message: * `string` | `MessageFn`*, code?: *`number`*, data?: *`any`*): `boolean`
|
||||
|
||||
*Defined in [assert.ts:27](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/assert.ts#L27)*
|
||||
*Defined in [assert.ts:27](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/assert.ts#L27)*
|
||||
|
||||
*__name__*: assert
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks that `test` is a truthy value. If value is falsy (`null`, `undefined`, `false`, ...), it throws an ExtError with the supplied `message` and an optional `code` and `data`. When `test` passes, `true` is returned.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
const { assert } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **bnToBn**(value?: * `BN` | `number`*): `BN`
|
||||
|
||||
*Defined in [bn/toBn.ts:24](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/bn/toBn.ts#L24)*
|
||||
*Defined in [bn/toBn.ts:24](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/bn/toBn.ts#L24)*
|
||||
|
||||
*__name__*: bnToBn
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null` inputs returns a `0x0` result, BN values returns the value, numnbers returns a BN representation.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import BN from 'bn.js';
|
||||
import { bnToBn } from '@polkadot/util';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **bnToHex**(value?: * `BN` | `number`*, bitLength?: *`number`*): `string`
|
||||
|
||||
*Defined in [bn/toHex.ts:28](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/bn/toHex.ts#L28)*
|
||||
*Defined in [bn/toHex.ts:28](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/bn/toHex.ts#L28)*
|
||||
|
||||
*__name__*: bnToHex
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null` inputs returns a `0x` result, BN values return the actual value as a `0x` prefixed hex value. Anything that is not a BN object throws an error. With `bitLength` set, it fixes the number to the specified length.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import BN from 'bn.js';
|
||||
import { bnToHex } from '@polkadot/util';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **bnToU8a**(value: * `BN` | `number`*, bitLength: *`number`*, isLe: *`boolean`*): `Uint8Array`
|
||||
|
||||
*Defined in [bn/toU8a.ts:26](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/bn/toU8a.ts#L26)*
|
||||
*Defined in [bn/toU8a.ts:26](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/bn/toU8a.ts#L26)*
|
||||
|
||||
*__name__*: bnToU8a
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null`/`undefined`/`NaN` inputs returns an empty `Uint8Array` result. `BN` input values return the actual bytes value converted to a `Uint8Array`. Optionally convert using little-endian format if `isLE` is set.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { bnToU8a } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **bufferToU8a**(buffer?: * `Buffer` | `number`[]*): `Uint8Array`
|
||||
|
||||
*Defined in [buffer/toU8a.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/buffer/toU8a.ts#L20)*
|
||||
*Defined in [buffer/toU8a.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/buffer/toU8a.ts#L20)*
|
||||
|
||||
*__name__*: bufferToU8a
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null` inputs returns an empty result, `Buffer` values return the actual value as a `Uint8Array`. Anything that is not a `Buffer` object throws an error.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { bufferToU8a } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **hexAddPrefix**(value: * `string` | `null` | `undefined`*): `string`
|
||||
|
||||
*Defined in [hex/addPrefix.ts:22](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/hex/addPrefix.ts#L22)*
|
||||
*Defined in [hex/addPrefix.ts:22](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/hex/addPrefix.ts#L22)*
|
||||
|
||||
*__name__*: hexAddPrefix
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Returns a `0x` prefixed string from the input value. If the input is already prefixed, it is returned unchanged.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { hexAddPrefix } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **hexFixLength**(value: *`string`*, bitLength?: *`number`*, withPadding?: *`boolean`*): `string`
|
||||
|
||||
*Defined in [hex/fixLength.ts:25](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/hex/fixLength.ts#L25)*
|
||||
*Defined in [hex/fixLength.ts:25](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/hex/fixLength.ts#L25)*
|
||||
|
||||
*__name__*: hexFixLength
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Returns a `0x` prefixed string with the specified number of bits contained in the return value. (If bitLength is -1, length checking is not done). Values with more bits are trimmed to the specified length. Input values with less bits are returned as-is by default. When `withPadding` is set, shorter values are padded with `0`.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { hexFixLength } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **hexHasPrefix**(value: * `string` | `null` | `undefined`*): `boolean`
|
||||
|
||||
*Defined in [hex/hasPrefix.ts:22](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/hex/hasPrefix.ts#L22)*
|
||||
*Defined in [hex/hasPrefix.ts:22](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/hex/hasPrefix.ts#L22)*
|
||||
|
||||
*__name__*: hexHasPrefix
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks for a valid hex input value and if the start matched `0x`
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { hexHasPrefix } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **hexStripPrefix**(value: * `string` | `null` | `undefined`*): `string`
|
||||
|
||||
*Defined in [hex/stripPrefix.ts:24](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/hex/stripPrefix.ts#L24)*
|
||||
*Defined in [hex/stripPrefix.ts:24](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/hex/stripPrefix.ts#L24)*
|
||||
|
||||
*__name__*: hexStripPrefix
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Tests for the existence of a `0x` prefix, and returns the value without the prefix. Un-prefixed values are returned as-is.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { hexStripPrefix } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **hexToBn**(_value?: * `undefined` | `string`*, isLe?: *`boolean`*): `BN`
|
||||
|
||||
*Defined in [hex/toBn.ts:30](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/hex/toBn.ts#L30)*
|
||||
*Defined in [hex/toBn.ts:30](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/hex/toBn.ts#L30)*
|
||||
|
||||
*__name__*: hexToBn
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null` inputs returns a `BN(0)` result. Hex input values return the actual value converted to a BN. Anything that is not a hex string (including the `0x` prefix) throws an error.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { hexToBn } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **hexToNumber**(value?: * `undefined` | `string`*): `number`
|
||||
|
||||
*Defined in [hex/toNumber.ts:22](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/hex/toNumber.ts#L22)*
|
||||
*Defined in [hex/toNumber.ts:22](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/hex/toNumber.ts#L22)*
|
||||
|
||||
*__name__*: hexToNumber
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null` inputs returns an NaN result, `hex` values return the actual value as a `Number`.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { hexToNumber } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **hexToU8a**(_value?: * `string` | `null`*, bitLength?: *`number`*): `Uint8Array`
|
||||
|
||||
*Defined in [hex/toU8a.ts:25](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/hex/toU8a.ts#L25)*
|
||||
*Defined in [hex/toU8a.ts:25](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/hex/toU8a.ts#L25)*
|
||||
|
||||
*__name__*: hexToU8a
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null` inputs returns an empty `Uint8Array` result. Hex input values return the actual bytes value converted to a Uint8Array. Anything that is not a hex string (including the `0x` prefix) throws an error.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isBn**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/bn.ts:23](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/bn.ts#L23)*
|
||||
*Defined in [is/bn.ts:23](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/bn.ts#L23)*
|
||||
|
||||
*__name__*: isBn
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input object is an instance of `BN` (bn.js).
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import BN from 'bn.js';
|
||||
import { isBn } from '@polkadot/util';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isBoolean**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/boolean.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/boolean.ts#L20)*
|
||||
*Defined in [is/boolean.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/boolean.ts#L20)*
|
||||
|
||||
*__name__*: isBoolean
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is a JavaScript boolean.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isBoolean } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isBuffer**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/buffer.ts:22](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/buffer.ts#L22)*
|
||||
*Defined in [is/buffer.ts:22](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/buffer.ts#L22)*
|
||||
|
||||
*__name__*: isBuffer
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input object is an instance of `Buffer`.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isBuffer } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isError**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/error.ts:22](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/error.ts#L22)*
|
||||
*Defined in [is/error.ts:22](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/error.ts#L22)*
|
||||
|
||||
*__name__*: isError
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input object is an instance of `Error`.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isError } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isFunction**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/function.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/function.ts#L20)*
|
||||
*Defined in [is/function.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/function.ts#L20)*
|
||||
|
||||
*__name__*: isFunction
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is a JavaScript function.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isFunction } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isHex**(_value: *`any`*, bitLength?: *`number`*, ignoreLength?: *`boolean`*): `boolean`
|
||||
|
||||
*Defined in [is/hex.ts:25](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/hex.ts#L25)*
|
||||
*Defined in [is/hex.ts:25](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/hex.ts#L25)*
|
||||
|
||||
*__name__*: isHex
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is a `0x` prefixed hex string. Optionally (`bitLength` !== -1) checks to see if the bitLength is correct.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isHex } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isInstanceOf**(value: *`any`*, clazz: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/instanceOf.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/instanceOf.ts#L20)*
|
||||
*Defined in [is/instanceOf.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/instanceOf.ts#L20)*
|
||||
|
||||
*__name__*: isInstanceOf
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is an instance of the test class.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isInstanceOf } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isIp**(value: *`string`*, type?: *`IpTypes`*): `boolean`
|
||||
|
||||
*Defined in [is/ip.ts:27](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/ip.ts#L27)*
|
||||
*Defined in [is/ip.ts:27](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/ip.ts#L27)*
|
||||
|
||||
*__name__*: isIp
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the value is a valid IP address. Optionally check for either v4/v6
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isIp } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isNull**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/null.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/null.ts#L20)*
|
||||
*Defined in [is/null.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/null.ts#L20)*
|
||||
|
||||
*__name__*: isNull
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is `null`.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isNull } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isNumber**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/number.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/number.ts#L20)*
|
||||
*Defined in [is/number.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/number.ts#L20)*
|
||||
|
||||
*__name__*: isNumber
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is a valid number.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isNumber } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isObject**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/object.ts:25](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/object.ts#L25)*
|
||||
*Defined in [is/object.ts:25](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/object.ts#L25)*
|
||||
|
||||
*__name__*: isObject
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is a JavaScript object.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isObject } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isObservable**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/observable.ts:27](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/observable.ts#L27)*
|
||||
*Defined in [is/observable.ts:27](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/observable.ts#L27)*
|
||||
|
||||
*__name__*: isBObservable
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input object is an instance of `BN` (bn.js).
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isObservable } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isString**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/string.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/string.ts#L20)*
|
||||
*Defined in [is/string.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/string.ts#L20)*
|
||||
|
||||
*__name__*: isString
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is a JavaScript string.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isString } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isU8a**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/u8a.ts:22](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/u8a.ts#L22)*
|
||||
*Defined in [is/u8a.ts:22](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/u8a.ts#L22)*
|
||||
|
||||
*__name__*: isU8a
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input object is an instance of `Uint8Array`.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isUint8Array } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **isUndefined**(value: *`any`*): `boolean`
|
||||
|
||||
*Defined in [is/undefined.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/is/undefined.ts#L20)*
|
||||
*Defined in [is/undefined.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/is/undefined.ts#L20)*
|
||||
|
||||
*__name__*: isUndefined
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks to see if the input value is `undefined`.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { isUndefined } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **format**(value: *`any`*): `any`
|
||||
|
||||
*Defined in [logger.ts:36](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/logger.ts#L36)*
|
||||
*Defined in [logger.ts:36](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/logger.ts#L36)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
@@ -25,7 +25,7 @@ ___
|
||||
|
||||
▸ **logger**(_type: *`string`*): `Logger`
|
||||
|
||||
*Defined in [logger.ts:105](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/logger.ts#L105)*
|
||||
*Defined in [logger.ts:105](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/logger.ts#L105)*
|
||||
|
||||
*__name__*: Logger
|
||||
|
||||
@@ -36,6 +36,7 @@ ___
|
||||
*__description__*: Returns a `Logger` that has `.log`, `.error`, `.warn` and `.debug` (controlled with environment `DEBUG=typeA,typeB`) methods. Logging is done with a consistent prefix (type of logger, date) followed by the actual message using the underlying console.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
const l from '@polkadot/util/logger')('test');
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **numberToHex**(value?: * `undefined` | `number`*, bitLength?: *`number`*): `string`
|
||||
|
||||
*Defined in [number/toHex.ts:25](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/number/toHex.ts#L25)*
|
||||
*Defined in [number/toHex.ts:25](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/number/toHex.ts#L25)*
|
||||
|
||||
*__name__*: numberToHex
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null`/`undefined`/`NaN` inputs returns an empty `0x` result. `number` input values return the actual bytes value converted to a `hex`. With `bitLength` set, it converts the number to the equivalent size.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { numberToHex } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **numberToU8a**(value?: * `undefined` | `number`*, bitLength?: *`number`*): `Uint8Array`
|
||||
|
||||
*Defined in [number/toU8a.ts:23](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/number/toU8a.ts#L23)*
|
||||
*Defined in [number/toU8a.ts:23](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/number/toU8a.ts#L23)*
|
||||
|
||||
*__name__*: numberToU8a
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null`/`undefined`/`NaN` inputs returns an empty `Uint8Array` result. `number` input values return the actual bytes value converted to a `Uint8Array`. With `bitLength`, it converts the value to the equivalent size.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { numberToU8a } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **promisify**(self: *`any`*, fn: *`Function`*, ...params: *`Array`<`any`>*): `Promise`<`any`>
|
||||
|
||||
*Defined in [promisify.ts:21](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/promisify.ts#L21)*
|
||||
*Defined in [promisify.ts:21](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/promisify.ts#L21)*
|
||||
|
||||
*__name__*: promisify
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Wraps the supplied async function `fn` that has a standard JS callback `(error: Error, result: any)` into a `Promise`, passing the supplied parameters. When `error` is set, the Promise is rejected, else the Promise resolves with the `result` value.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
const { promisify } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,17 +8,18 @@
|
||||
|
||||
▸ **stringLowerFirst**(_value: *`string`*): `string`
|
||||
|
||||
*Defined in [string/lowerFirst.ts:23](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/string/lowerFirst.ts#L23)*
|
||||
*Defined in [string/lowerFirst.ts:23](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/string/lowerFirst.ts#L23)*
|
||||
|
||||
*__name__*: stringLowerFirst
|
||||
|
||||
*__signature__*: stringLowerFirst (_value: string): string
|
||||
*__signature__*: stringLowerFirst (\_value: string): string
|
||||
|
||||
*__summary__*: Lowercase the first letter of a string
|
||||
|
||||
*__description__*: Lowercase the first letter of a string
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { stringLowerFirst } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **stringShorten**(_value: *`any`*, prefixLength?: *`number`*): `string`
|
||||
|
||||
*Defined in [string/shorten.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/string/shorten.ts#L20)*
|
||||
*Defined in [string/shorten.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/string/shorten.ts#L20)*
|
||||
|
||||
*__name__*: stringShorten
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Checks the string against the `prefixLength`, if longer than dopuble this, shortens it by placing `..` in the middle of it
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { stringShorten } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **stringToU8a**(value?: * `undefined` | `string`*): `Uint8Array`
|
||||
|
||||
*Defined in [string/toU8a.ts:24](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/string/toU8a.ts#L24)*
|
||||
*Defined in [string/toU8a.ts:24](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/string/toU8a.ts#L24)*
|
||||
|
||||
*__name__*: stringToU8a
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: String input values return the actual encoded `UInt8Array`. `null` or `undefined` values returns an empty encoded array.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { stringToU8a } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,17 +8,18 @@
|
||||
|
||||
▸ **stringUpperFirst**(_value: *`string`*): `string`
|
||||
|
||||
*Defined in [string/upperFirst.ts:23](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/string/upperFirst.ts#L23)*
|
||||
*Defined in [string/upperFirst.ts:23](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/string/upperFirst.ts#L23)*
|
||||
|
||||
*__name__*: stringUpperFirst
|
||||
|
||||
*__signature__*: stringUpperFirst (_value: string): string
|
||||
*__signature__*: stringUpperFirst (\_value: string): string
|
||||
|
||||
*__summary__*: Lowercase the first letter of a string
|
||||
|
||||
*__description__*: Lowercase the first letter of a string
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { stringUpperFirst } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **syncify**(promise: *`Promise`<`any`>*): `any`
|
||||
|
||||
*Defined in [syncify.ts:11](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/syncify.ts#L11)*
|
||||
*Defined in [syncify.ts:11](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/syncify.ts#L11)*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **u8aConcat**(..._list: *`Array`< `Uint8Array` | `string`>*): `Uint8Array`
|
||||
|
||||
*Defined in [u8a/concat.ts:25](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/u8a/concat.ts#L25)*
|
||||
*Defined in [u8a/concat.ts:25](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/u8a/concat.ts#L25)*
|
||||
|
||||
*__name__*: u8aConcat
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Concatenates the input arrays into a single `UInt8Array`.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { u8aConcat } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **u8aFixLength**(value: *`Uint8Array`*, bitLength?: *`number`*, atStart?: *`boolean`*): `Uint8Array`
|
||||
|
||||
*Defined in [u8a/fixLength.ts:22](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/u8a/fixLength.ts#L22)*
|
||||
*Defined in [u8a/fixLength.ts:22](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/u8a/fixLength.ts#L22)*
|
||||
|
||||
*__name__*: u8aFixLength
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: Returns a uint8Array with the specified number of bits contained in the return value. (If bitLength is -1, length checking is not done). Values with more bits are trimmed to the specified length.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { u8aFixLength } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **u8aToBn**(value: *`Uint8Array`*, isLe: *`boolean`*): `BN`
|
||||
|
||||
*Defined in [u8a/toBn.ts:25](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/u8a/toBn.ts#L25)*
|
||||
*Defined in [u8a/toBn.ts:25](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/u8a/toBn.ts#L25)*
|
||||
|
||||
*__name__*: u8aToBn
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `UInt8Array` input values return the actual BN. `null` or `undefined` values returns an `0x0` value.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { u8aToBn } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **u8aToBuffer**(value?: *`Uint8Array`*): `Buffer`
|
||||
|
||||
*Defined in [u8a/toBuffer.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/u8a/toBuffer.ts#L20)*
|
||||
*Defined in [u8a/toBuffer.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/u8a/toBuffer.ts#L20)*
|
||||
|
||||
*__name__*: u8aToBuffer
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null` inputs returns an empty `Buffer` result. `UInt8Array` input values return the actual bytes value converted to a `Buffer`. Anything that is not a `UInt8Array` throws an error.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { u8aToBuffer } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **u8aToHex**(value?: * `Uint8Array` | `null`*, bitLength?: *`number`*, isPrefixed?: *`boolean`*): `string`
|
||||
|
||||
*Defined in [u8a/toHex.ts:20](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/u8a/toHex.ts#L20)*
|
||||
*Defined in [u8a/toHex.ts:20](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/u8a/toHex.ts#L20)*
|
||||
|
||||
*__name__*: u8aToHex
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `UInt8Array` input values return the actual hex string. `null` or `undefined` values returns an `0x` string.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **u8aToString**(value?: *`Uint8Array`*): `string`
|
||||
|
||||
*Defined in [u8a/toString.ts:24](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/u8a/toString.ts#L24)*
|
||||
*Defined in [u8a/toString.ts:24](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/u8a/toString.ts#L24)*
|
||||
|
||||
*__name__*: u8aToString
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `UInt8Array` input values return the actual decoded utf-8 string. `null` or `undefined` values returns an empty string.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { u8aToString } from '@polkadot/util';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
▸ **u8aToU8a**(value?: * `Array`<`number`> | `Buffer` | `Uint8Array` | `string` | `null`*): `Uint8Array`
|
||||
|
||||
*Defined in [u8a/toU8a.ts:28](https://github.com/polkadot-js/common/blob/5ce8f91/packages/util/src/u8a/toU8a.ts#L28)*
|
||||
*Defined in [u8a/toU8a.ts:28](https://github.com/polkadot-js/common/blob/0cb6e6c/packages/util/src/u8a/toU8a.ts#L28)*
|
||||
|
||||
*__name__*: u8aToU8a
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*__description__*: `null` inputs returns a `[]` result, Uint8Array values returns the value, hex strings returns a Uint8Array representation.
|
||||
|
||||
*__example__*:
|
||||
|
||||
```javascript
|
||||
import { u8aToU8a } from '@polkadot/util';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user