UNPKG

@alexkeating/common-utilities

Version:

Our **Common Utilities** package is a set of helper tools and utilities that are used throughout our libraries and apps. This includes things like our constants, types that are commonly shared across packages, and various utilities and helper functions.

25 lines (24 loc) 1.38 kB
export declare const toBaseUnits: (amount: string, decimals?: number) => string; export declare const toWholeUnits: (amount: string, decimals?: number) => string; declare type NumericalFormat = 'currency' | 'currencyShort' | 'number' | 'numberShort' | 'percent' | 'percentShort' | 'exponential'; interface ReadableNumberParams { value: number | string; unit?: string; decimals?: number; separator?: string; format?: NumericalFormat | string; } export declare const formatValueTo: ({ value, unit, decimals, separator, format, }: ReadableNumberParams) => string; interface ReadableNumbersInterface { toCurrency: (args: Exclude<ReadableNumberParams, 'format'>) => string; toCurrencyShort: (args: Exclude<ReadableNumberParams, 'format'>) => string; toDollars: (args: Exclude<ReadableNumberParams, 'format' | 'decimals'>) => string; toNumber: (args: Exclude<ReadableNumberParams, 'format'>) => string; toNumberShort: (args: Exclude<ReadableNumberParams, 'format'>) => string; toPercent: (args: Exclude<ReadableNumberParams, 'format'>) => string; toPercentDecimals: (args: Exclude<ReadableNumberParams, 'format'>) => string; toExponential: (args: Exclude<ReadableNumberParams, 'format'>) => string; toCustomFormat: (args: ReadableNumberParams) => string; } export declare const readableNumbers: ReadableNumbersInterface; export {};