UNPKG

ngx-numeral

Version:

An Angular pipe module for interfacing the Awesome Numeraljs library.

61 lines (60 loc) 2.02 kB
export interface NumeralJSLocale { delimiters: { thousands: string; decimal: string; }; abbreviations: { thousand: string; million: string; billion: string; trillion: string; }; ordinal(num: number): string; currency: { symbol: string; }; } export declare type RoundingFunction = (value: number) => number; export interface NumeralJsFormat { regexps: { format: RegExp; unformat: RegExp; }; format: (value: any, format: string, roundingFunction: RoundingFunction) => string; unformat: (value: string) => number; } export declare type RegisterType = "format" | "locale"; export interface Numeral { (value?: any): Numeral; version: string; isNumeral: boolean; /** * This function sets the current locale. If no arguments are passed in, * it will simply return the current global locale key. */ locale(key?: string): string; /** * Registers a language definition or a custom format definition. * * @param what Allowed values are: either 'format' or 'locale' * @param key The key of the registerd type, e.g. 'de' for a german locale definition * @param value The locale definition or the format definitiion */ register(what: RegisterType, key: string, value: NumeralJSLocale | NumeralJsFormat): NumeralJSLocale | NumeralJsFormat; zeroFormat(format: string): void; nullFormat(format: string): void; defaultFormat(format: string): void; clone(): Numeral; format(inputString?: string, roundingFunction?: RoundingFunction): string; formatCurrency(inputString?: string): string; unformat(inputString: string): number; value(): number; valueOf(): number; set(value: any): Numeral; add(value: any): Numeral; subtract(value: any): Numeral; multiply(value: any): Numeral; divide(value: any): Numeral; difference(value: any): number; validate(value: any, culture: any): boolean; }