UNPKG

552 BTypeScriptView Raw
1/**
2 * @name numberToU8a
3 * @summary Creates a Uint8Array object from a number.
4 * @description
5 * `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.
6 * @example
7 * <BR>
8 *
9 * ```javascript
10 * import { numberToU8a } from '@polkadot/util';
11 *
12 * numberToU8a(0x1234); // => [0x12, 0x34]
13 * ```
14 */
15export declare function numberToU8a(value?: number | null, bitLength?: number): Uint8Array;