node-bcc
Version:
A simple Block Check Character library.
48 lines (47 loc) • 1.26 kB
TypeScript
/**
* This class provides methods for handling hex strings.
*
* @export
* @class Hex
*/
export declare class Hex {
/**
* Splits the given hexadecimal string.
*
* The input string should not contain spaces and the individual bytes should
* not be prepended by '0x'.
*
* ## Example
* **Input:**
* ``` js
* 'AABBCCDDEEFF'
* ```
*
* **Output:**
* ``` js
* ['AA', 'BB', 'CC', 'DD', 'EE', 'FF']
* ```
*
* @static
* @param hex The hexadecimal string to split.
* @returns An array of hex strings.
*/
static split(hex: string): string[] | null;
/**
* Validates the given hexadecimal string.
*
* @static
* @param hex The hexadecimal string to validate.
* @returns Whether the given string is a valid hexadecimal string.
*/
static validate(hex: string): boolean;
/**
* Converts the given array of numbers to a hexadecimal string.
*
* @static
* @param array The array to convert.
* @param uppercase Whether the string should be uppercase.
* @returns The given array of numbers as a hexadecimal string.
*/
static toHexString(array: number[], uppercase?: boolean): string | null;
}