UNPKG

javascript-binary-converter

Version:

A utility package to quickly handle and convert various Javascript binary objects

20 lines (19 loc) 804 B
import { FloatConversionConfig, ToBytesConfig } from "../sharedTypes"; /** * This class handles any number|bigint, in any type Number notation(decimal,octal,hex,binary) */ export default class NumberConverter { protected original: number | bigint; constructor(original: number | bigint); toBinary({ precision }?: FloatConversionConfig): string; toInteger({ isSigned }?: { isSigned?: boolean; }): number; /** * Does not support bigint(above 32 bit) or floating point. */ toBytes({ endianness }?: Omit<ToBytesConfig, 'isSigned'>): string[]; toDecimalBytes({ endianness, isSigned }?: ToBytesConfig): number[]; toHexString({ precision }?: FloatConversionConfig): string; toFloat({ precision }?: FloatConversionConfig): number; }