1 | export as namespace numeral;
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | declare function numeral(input?: any): numeral.Numeral;
|
7 |
|
8 | type VERSION = "2.0.6";
|
9 |
|
10 | declare namespace numeral {
|
11 |
|
12 | function isNumeral(value: any): boolean;
|
13 |
|
14 | const version: VERSION;
|
15 | const options: NumeralJSOptions;
|
16 | |
17 |
|
18 |
|
19 | const locales: NumeralJSLocales;
|
20 |
|
21 | |
22 |
|
23 |
|
24 | const formats: NumeralJSFormats;
|
25 |
|
26 | |
27 |
|
28 |
|
29 | const _: NumeralJSUtils;
|
30 |
|
31 | |
32 |
|
33 |
|
34 |
|
35 | function locale(key?: string): string;
|
36 |
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | function localeData(key?: string): NumeralJSLocale;
|
45 |
|
46 | |
47 |
|
48 |
|
49 | function reset(): void;
|
50 |
|
51 | function zeroFormat(format: string): void;
|
52 | function nullFormat(format: string): void;
|
53 | function defaultFormat(format: string): void;
|
54 | |
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 | function register(
|
62 | what: RegisterType,
|
63 | key: string,
|
64 | value: NumeralJSLocale | NumeralJSFormat,
|
65 | ): NumeralJSLocale | NumeralJSFormat;
|
66 |
|
67 | function validate(value: any, culture: any): boolean;
|
68 |
|
69 | const fn: Numeral["prototype"];
|
70 |
|
71 |
|
72 | class Numeral {
|
73 | constructor(input: any, value: number);
|
74 | prototype: Numeral;
|
75 | clone(): Numeral;
|
76 | format(inputString?: string, roundingFunction?: RoundingFunction): string;
|
77 | value(): number | null;
|
78 | input(): any;
|
79 | set(value: any): Numeral;
|
80 | add(value: any): Numeral;
|
81 | subtract(value: any): Numeral;
|
82 | multiply(value: any): Numeral;
|
83 | divide(value: any): Numeral;
|
84 | difference(value: any): number;
|
85 | }
|
86 |
|
87 | // http://numeraljs.com/#locales
|
88 | interface NumeralJSLocale {
|
89 | delimiters: {
|
90 | thousands: string;
|
91 | decimal: string;
|
92 | };
|
93 | abbreviations: {
|
94 | thousand: string;
|
95 | million: string;
|
96 | billion: string;
|
97 | trillion: string;
|
98 | };
|
99 | ordinal(num: number): string;
|
100 | currency: {
|
101 | symbol: string;
|
102 | };
|
103 | }
|
104 |
|
105 | interface NumeralJSLocales {
|
106 | [id: string]: NumeralJSLocale;
|
107 | }
|
108 |
|
109 | interface NumeralJSOptions {
|
110 | currentLocale: string;
|
111 | zeroFormat: string;
|
112 | nullFormat: string;
|
113 | defaultFormat: string;
|
114 | scalePercentBy100: boolean;
|
115 | }
|
116 |
|
117 | type RoundingFunction = (value: number) => number;
|
118 |
|
119 |
|
120 | interface NumeralJSFormat {
|
121 | regexps: {
|
122 | format: RegExp;
|
123 | unformat: RegExp;
|
124 | };
|
125 | format: (value: any, format: string, roundingFunction: RoundingFunction) => string;
|
126 | unformat: (value: string) => number;
|
127 | }
|
128 |
|
129 | interface NumeralJSFormats {
|
130 | [id: string]: NumeralJSFormat;
|
131 | }
|
132 |
|
133 | interface NumeralJSUtils {
|
134 | numberToFormat: (value: number, format: string, roundingFunction?: RoundingFunction) => string;
|
135 | stringToNumber: (string: string) => number;
|
136 | }
|
137 |
|
138 | type RegisterType = "format" | "locale";
|
139 | }
|
140 |
|
141 | export = numeral;
|