format-number
Version:
Formats numbers with separators every 3 digits and currency etc. Highly configurable.
26 lines (22 loc) • 668 B
TypeScript
interface IFormatNumberOptions {
negativeType?: 'right' | 'left' | 'brackets' | 'none';
negativeLeftSymbol?: string;
negativeRightSymbol?: string;
negativeLeftOut?: boolean;
negativeRightOut?: boolean;
prefix?: string;
suffix?: string;
integerSeparator?: string;
decimalsSeparator?: string;
decimal?: string;
padLeft?: number;
padRight?: number;
round?: number;
truncate?: number;
}
interface IFormatNumberOverrideOptions {
noUnits?: boolean;
noSeparator?: boolean;
}
export default function formatter(options?: IFormatNumberOptions): format;
type format = (number: number, overrideOptions?: IFormatNumberOverrideOptions) => string;