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