Converts tests to TypeScript (#300)
This commit is contained in:
@@ -8,7 +8,6 @@ import isUndefined from '../is/undefined';
|
||||
|
||||
/**
|
||||
* @name numberToHex
|
||||
* @signature numberToHex (value?: number): string
|
||||
* @summary Creates a hex value from a number.
|
||||
* @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.
|
||||
@@ -22,7 +21,7 @@ import isUndefined from '../is/undefined';
|
||||
* numberToHex(0x1234, 32); // => 0x00001234
|
||||
* ```
|
||||
*/
|
||||
export default function numberToHex (value?: number, bitLength: number = -1): string {
|
||||
export default function numberToHex (value?: number | null, bitLength: number = -1): string {
|
||||
if (isUndefined(value) || isNull(value) || isNaN(value)) {
|
||||
return '0x';
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import numberToHex from './toHex';
|
||||
|
||||
/**
|
||||
* @name numberToU8a
|
||||
* @signature numberToU8a (value?: number, bitLenght: number = -1): Uint8Array
|
||||
* @summary Creates a Uint8Array object from a number.
|
||||
* @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.
|
||||
@@ -20,7 +19,7 @@ import numberToHex from './toHex';
|
||||
* numberToU8a(0x1234); // => [0x12, 0x34]
|
||||
* ```
|
||||
*/
|
||||
export default function numberToU8a (value?: number, bitLength: number = -1): Uint8Array {
|
||||
export default function numberToU8a (value?: number | null, bitLength: number = -1): Uint8Array {
|
||||
if (!value || isNaN(value)) {
|
||||
return new Uint8Array([]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user