@sebgroup/frontend-tools
Version:
A set of frontend tools
18 lines (17 loc) • 819 B
TypeScript
export interface ToCurrencyOptions {
/** The thousand separator, default is a comma `,` */
separator?: string;
/** The decimal point symbol, default is a dot `.` */
decimalSymbol?: string;
/** Whether to show the decimal places or not, default is `true` */
showDecimals?: boolean;
/** The number of decimals places to show, default is `2` */
numOfDecimals?: number;
}
/**
* Formats a number or a string number to a currency format
* @param {number} value raw number value
* @param {ToCurrencyOptions} options You can control the sperator, radix, decimals visibility and number of decimal places using these options
* @returns {string} The formatted currency string
*/
export declare function toCurrency(value: number | string, options?: ToCurrencyOptions): string;