dbl-utils
Version:
Utilities for dbl, adba and others projects
23 lines (22 loc) • 749 B
TypeScript
type FormatType = 'number-compact' | 'numbercompact' | 'number' | 'currency' | 'dictionary' | 'date' | 'time' | 'date-time' | 'datetime';
interface FormatConfig {
format?: FormatType;
formatConf?: string | Intl.NumberFormatOptions;
context?: any;
currency?: string;
}
/**
* Formats a value based on the provided configuration.
*
* @param value - The value to format
* @param conf - Configuration options for formatting
* @returns The formatted value or the original value if the format is not specified
*
* @example
* ```ts
* formatValue(1000, { format: 'currency', currency: 'USD' });
* // => "$1,000.00" in an English locale
* ```
*/
export default function formatValue(value: any, conf: FormatConfig): any;
export {};