@singleton-i18n/angular-client
Version:
Singleton client code for Angular 10.
53 lines (52 loc) • 2.33 kB
TypeScript
import { NumberFormatTypes, DataForNumber, DataForCurrency, RoundingMode, NumberFormatOptions } from './number.format.model';
interface ParsedNumber {
digits: number[];
integerLen: number;
}
declare class Formatter {
decimal(data: DataForNumber, locale: string): (value: number, formatOptions?: NumberFormatOptions) => string;
currencies(data: DataForCurrency, locale: string): (value: number, currencyCode: string, formatOptions?: NumberFormatOptions) => string;
currencySymbol(data: DataForCurrency): (currencyCode: string) => any;
percent(data: DataForNumber): (value: number, formatOptions?: NumberFormatOptions) => string;
plural(data: DataForNumber): (value: number, min?: number, max?: number) => string;
resetFormats(formats: any, round: RoundingMode, formatOptions?: NumberFormatOptions): any;
/**
* Get info from the formats
* eg: ¤#,##0.00
* return: { gSize: 3, lgSize: 3, maxFrac: 2, minFrac: 2, minInt: 1, negPre: "-¤", posPre: "¤" }
*/
parseFormats(format: string, minusSign?: string): {
minInt: number;
minFrac: number;
maxFrac: number;
posPre: string;
posSuf: string;
negPre: string;
negSuf: string;
gSize: number;
lgSize: number;
round: RoundingMode;
};
parseNumber(numStr: string): ParsedNumber;
/**
* rounding number
*/
roundingNumber(number: number, minFrac: number, maxFrac: number, mode: RoundingMode): string;
resetCurrencyFormatsInfo(formatsInfo: any, data: DataForCurrency, currencyCode: string, formatOptions?: NumberFormatOptions): any;
resetPercentNumber(num: number): string;
resetString(formatsInfo: any, symbol: any, value: any, compactData?: any, locale?: string): string;
}
export declare class FormatterFactory {
formatter: Formatter;
mapping: {
[key: string]: any;
};
constructor();
getFormatter(locale: string, type: NumberFormatTypes): Function;
currencies(data: DataForCurrency, locale: string): Function;
currenySymbol(data: DataForCurrency, locale: string): Function;
percent(data: DataForNumber, locale: string): Function;
decimal(data: DataForNumber, locale: string): Function;
roundNumberForPlural(data: DataForNumber, locale: string): Function;
}
export {};