UNPKG

@kodex-data/prototypes

Version:

A library of TypeScript prototypes that extend built-in types in JavaScript, providing additional functionality to make development easier and more efficient. This library includes prototypes for working with big numbers, Ethereum Virtual Machine (EVM) fu

56 lines (55 loc) 1.84 kB
import * as Utils from './utils'; declare global { interface String { strip0x(): string; isHex(): boolean; toHex(): string; fromHex(): string; toAscii(): string; isAddress(): boolean; isEtherAddress(): boolean; addrIsEqual(address: string): boolean; toChecksumAddress(): string; isKeccakHash(): boolean; trimAddress(): string; findHex(): string[]; findHex(type: 'address'): string[]; findHex(type: 'keccak'): string[]; toSha3(): string; toUtf8Bytes(): Uint8Array; isNumber(): boolean; toUint(add0x?: boolean): string; isValidJSON(): boolean; isTwitterUrl(): boolean; getTwitterUsername(): string | undefined; rndHex(l?: number): string; sleep(): Promise<void>; /** * chops given string into 32bit string array (64 length) * regex: `String(this).replace(/0x/i, '').match(/.{1,64}/g)` * @date 9/14/2022 - 6:17:11 AM * * @returns {string[]} */ split64(_strict?: boolean): string[]; /** * chops given string into 16bit string array (32 length) * regex: `String(this).replace(/0x/i, '').match(/.{1,32}/g)` * @date 9/14/2022 - 6:17:11 AM * * @returns {string[]} */ split32(_strict?: boolean): string[]; parseJSON<T = any>(errorHandler?: Function): T; isValidJson(): boolean; isValidJSON(): boolean; formatJSON(options?: Partial<Utils.ToJSON_WithSpaces_Options>): string; formatJson(options?: Partial<Utils.ToJSON_WithSpaces_Options>): string; } interface Number { toUint(add0x?: boolean): string; toHex(): string; isOdd(): boolean; } } export {};