@formatjs/icu-skeleton-parser 1.3.11 → 1.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/date-time.d.ts +8 -0
- package/date-time.d.ts.map +1 -0
- package/date-time.js +125 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +5 -0
- package/lib/date-time.d.ts +8 -0
- package/lib/date-time.d.ts.map +1 -0
- package/lib/date-time.js +121 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/number.d.ts +14 -0
- package/lib/number.d.ts.map +1 -0
- package/lib/number.js +295 -0
- package/lib/regex.generated.d.ts +2 -0
- package/lib/regex.generated.d.ts.map +1 -0
- package/lib/regex.generated.js +2 -0
- package/number.d.ts +14 -0
- package/number.d.ts.map +1 -0
- package/number.js +300 -0
- package/package.json +2 -2
- package/regex.generated.d.ts +2 -0
- package/regex.generated.d.ts.map +1 -0
- package/regex.generated.js +5 -0
- package/BUILD +0 -80
- package/CHANGELOG.md +0 -133
- package/date-time.ts +0 -144
- package/index.ts +0 -2
- package/number.ts +0 -357
- package/regex.generated.ts +0 -2
- package/scripts/global.ts +0 -1
- package/scripts/regex-gen.ts +0 -19
- package/tests/__snapshots__/index.test.ts.snap +0 -389
- package/tests/index.test.ts +0 -65
- package/tsconfig.json +0 -5
|
@@ -1,389 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`[parseNumberSkeleton] case: "% .##" 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"maximumFractionDigits": 2,
|
|
6
|
-
"style": "percent",
|
|
7
|
-
}
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
exports[`[parseNumberSkeleton] case: "%x100" 1`] = `
|
|
11
|
-
Object {
|
|
12
|
-
"scale": 100,
|
|
13
|
-
"style": "percent",
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
exports[`[parseNumberSkeleton] case: "()!" 1`] = `
|
|
18
|
-
Object {
|
|
19
|
-
"currencySign": "accounting",
|
|
20
|
-
"signDisplay": "always",
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
exports[`[parseNumberSkeleton] case: "()" 1`] = `
|
|
25
|
-
Object {
|
|
26
|
-
"currencySign": "accounting",
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
exports[`[parseNumberSkeleton] case: "()?" 1`] = `
|
|
31
|
-
Object {
|
|
32
|
-
"currencySign": "accounting",
|
|
33
|
-
"signDisplay": "exceptZero",
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
exports[`[parseNumberSkeleton] case: "+!" 1`] = `
|
|
38
|
-
Object {
|
|
39
|
-
"signDisplay": "always",
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
exports[`[parseNumberSkeleton] case: "+?" 1`] = `
|
|
44
|
-
Object {
|
|
45
|
-
"signDisplay": "exceptZero",
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
exports[`[parseNumberSkeleton] case: "+_" 1`] = `
|
|
50
|
-
Object {
|
|
51
|
-
"signDisplay": "never",
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
exports[`[parseNumberSkeleton] case: "." 1`] = `
|
|
56
|
-
Object {
|
|
57
|
-
"maximumFractionDigits": 0,
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
exports[`[parseNumberSkeleton] case: ".##" 1`] = `
|
|
62
|
-
Object {
|
|
63
|
-
"maximumFractionDigits": 2,
|
|
64
|
-
}
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
exports[`[parseNumberSkeleton] case: ".##/@##r" 1`] = `
|
|
68
|
-
Object {
|
|
69
|
-
"maximumFractionDigits": 2,
|
|
70
|
-
"maximumSignificantDigits": 3,
|
|
71
|
-
"minimumSignificantDigits": 1,
|
|
72
|
-
"roundingPriority": "morePrecision",
|
|
73
|
-
}
|
|
74
|
-
`;
|
|
75
|
-
|
|
76
|
-
exports[`[parseNumberSkeleton] case: ".##/@##s" 1`] = `
|
|
77
|
-
Object {
|
|
78
|
-
"maximumFractionDigits": 2,
|
|
79
|
-
"maximumSignificantDigits": 3,
|
|
80
|
-
"minimumSignificantDigits": 1,
|
|
81
|
-
"roundingPriority": "lessPrecision",
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
|
|
85
|
-
exports[`[parseNumberSkeleton] case: ".##/w" 1`] = `
|
|
86
|
-
Object {
|
|
87
|
-
"maximumFractionDigits": 2,
|
|
88
|
-
"trailingZeroDisplay": "stripIfInteger",
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
91
|
-
|
|
92
|
-
exports[`[parseNumberSkeleton] case: ".00/w currency/CAD" 1`] = `
|
|
93
|
-
Object {
|
|
94
|
-
"currency": "CAD",
|
|
95
|
-
"maximumFractionDigits": 2,
|
|
96
|
-
"minimumFractionDigits": 2,
|
|
97
|
-
"style": "currency",
|
|
98
|
-
"trailingZeroDisplay": "stripIfInteger",
|
|
99
|
-
}
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
|
-
exports[`[parseNumberSkeleton] case: "000" 1`] = `
|
|
103
|
-
Object {
|
|
104
|
-
"minimumIntegerDigits": 3,
|
|
105
|
-
}
|
|
106
|
-
`;
|
|
107
|
-
|
|
108
|
-
exports[`[parseNumberSkeleton] case: "E+!00" 1`] = `
|
|
109
|
-
Object {
|
|
110
|
-
"minimumIntegerDigits": 2,
|
|
111
|
-
"notation": "scientific",
|
|
112
|
-
"signDisplay": "always",
|
|
113
|
-
}
|
|
114
|
-
`;
|
|
115
|
-
|
|
116
|
-
exports[`[parseNumberSkeleton] case: "E0" 1`] = `
|
|
117
|
-
Object {
|
|
118
|
-
"minimumIntegerDigits": 1,
|
|
119
|
-
"notation": "scientific",
|
|
120
|
-
}
|
|
121
|
-
`;
|
|
122
|
-
|
|
123
|
-
exports[`[parseNumberSkeleton] case: "EE+?000" 1`] = `
|
|
124
|
-
Object {
|
|
125
|
-
"minimumIntegerDigits": 3,
|
|
126
|
-
"notation": "engineering",
|
|
127
|
-
"signDisplay": "exceptZero",
|
|
128
|
-
}
|
|
129
|
-
`;
|
|
130
|
-
|
|
131
|
-
exports[`[parseNumberSkeleton] case: "compact-long" 1`] = `
|
|
132
|
-
Object {
|
|
133
|
-
"compactDisplay": "long",
|
|
134
|
-
"notation": "compact",
|
|
135
|
-
}
|
|
136
|
-
`;
|
|
137
|
-
|
|
138
|
-
exports[`[parseNumberSkeleton] case: "compact-short" 1`] = `
|
|
139
|
-
Object {
|
|
140
|
-
"compactDisplay": "short",
|
|
141
|
-
"notation": "compact",
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
144
|
-
|
|
145
|
-
exports[`[parseNumberSkeleton] case: "currency/CAD ." 1`] = `
|
|
146
|
-
Object {
|
|
147
|
-
"currency": "CAD",
|
|
148
|
-
"maximumFractionDigits": 0,
|
|
149
|
-
"style": "currency",
|
|
150
|
-
}
|
|
151
|
-
`;
|
|
152
|
-
|
|
153
|
-
exports[`[parseNumberSkeleton] case: "currency/GBP .0*/@@@" 1`] = `
|
|
154
|
-
Object {
|
|
155
|
-
"currency": "GBP",
|
|
156
|
-
"maximumSignificantDigits": 3,
|
|
157
|
-
"minimumFractionDigits": 1,
|
|
158
|
-
"minimumSignificantDigits": 3,
|
|
159
|
-
"style": "currency",
|
|
160
|
-
}
|
|
161
|
-
`;
|
|
162
|
-
|
|
163
|
-
exports[`[parseNumberSkeleton] case: "currency/GBP .00##/@@@ unit-width-full-name" 1`] = `
|
|
164
|
-
Object {
|
|
165
|
-
"currency": "GBP",
|
|
166
|
-
"currencyDisplay": "name",
|
|
167
|
-
"maximumFractionDigits": 4,
|
|
168
|
-
"maximumSignificantDigits": 3,
|
|
169
|
-
"minimumFractionDigits": 2,
|
|
170
|
-
"minimumSignificantDigits": 3,
|
|
171
|
-
"style": "currency",
|
|
172
|
-
"unitDisplay": "long",
|
|
173
|
-
}
|
|
174
|
-
`;
|
|
175
|
-
|
|
176
|
-
exports[`[parseNumberSkeleton] case: "currency/GBP .00##/@@@" 1`] = `
|
|
177
|
-
Object {
|
|
178
|
-
"currency": "GBP",
|
|
179
|
-
"maximumFractionDigits": 4,
|
|
180
|
-
"maximumSignificantDigits": 3,
|
|
181
|
-
"minimumFractionDigits": 2,
|
|
182
|
-
"minimumSignificantDigits": 3,
|
|
183
|
-
"style": "currency",
|
|
184
|
-
}
|
|
185
|
-
`;
|
|
186
|
-
|
|
187
|
-
exports[`[parseNumberSkeleton] case: "engineering" 1`] = `
|
|
188
|
-
Object {
|
|
189
|
-
"notation": "engineering",
|
|
190
|
-
}
|
|
191
|
-
`;
|
|
192
|
-
|
|
193
|
-
exports[`[parseNumberSkeleton] case: "engineering/sign-except-zero" 1`] = `
|
|
194
|
-
Object {
|
|
195
|
-
"notation": "engineering",
|
|
196
|
-
"signDisplay": "exceptZero",
|
|
197
|
-
}
|
|
198
|
-
`;
|
|
199
|
-
|
|
200
|
-
exports[`[parseNumberSkeleton] case: "integer-width/*000" 1`] = `
|
|
201
|
-
Object {
|
|
202
|
-
"minimumIntegerDigits": 3,
|
|
203
|
-
}
|
|
204
|
-
`;
|
|
205
|
-
|
|
206
|
-
exports[`[parseNumberSkeleton] case: "measure-unit/length-meter .00##/@@@ unit-width-full-name" 1`] = `
|
|
207
|
-
Object {
|
|
208
|
-
"currencyDisplay": "name",
|
|
209
|
-
"maximumFractionDigits": 4,
|
|
210
|
-
"maximumSignificantDigits": 3,
|
|
211
|
-
"minimumFractionDigits": 2,
|
|
212
|
-
"minimumSignificantDigits": 3,
|
|
213
|
-
"style": "unit",
|
|
214
|
-
"unit": "meter",
|
|
215
|
-
"unitDisplay": "long",
|
|
216
|
-
}
|
|
217
|
-
`;
|
|
218
|
-
|
|
219
|
-
exports[`[parseNumberSkeleton] case: "measure-unit/length-meter .00##/@@@" 1`] = `
|
|
220
|
-
Object {
|
|
221
|
-
"maximumFractionDigits": 4,
|
|
222
|
-
"maximumSignificantDigits": 3,
|
|
223
|
-
"minimumFractionDigits": 2,
|
|
224
|
-
"minimumSignificantDigits": 3,
|
|
225
|
-
"style": "unit",
|
|
226
|
-
"unit": "meter",
|
|
227
|
-
}
|
|
228
|
-
`;
|
|
229
|
-
|
|
230
|
-
exports[`[parseNumberSkeleton] case: "notation-simple" 1`] = `
|
|
231
|
-
Object {
|
|
232
|
-
"notation": "standard",
|
|
233
|
-
}
|
|
234
|
-
`;
|
|
235
|
-
|
|
236
|
-
exports[`[parseNumberSkeleton] case: "percent .##" 1`] = `
|
|
237
|
-
Object {
|
|
238
|
-
"maximumFractionDigits": 2,
|
|
239
|
-
"style": "percent",
|
|
240
|
-
}
|
|
241
|
-
`;
|
|
242
|
-
|
|
243
|
-
exports[`[parseNumberSkeleton] case: "percent .0###" 1`] = `
|
|
244
|
-
Object {
|
|
245
|
-
"maximumFractionDigits": 4,
|
|
246
|
-
"minimumFractionDigits": 1,
|
|
247
|
-
"style": "percent",
|
|
248
|
-
}
|
|
249
|
-
`;
|
|
250
|
-
|
|
251
|
-
exports[`[parseNumberSkeleton] case: "percent .00/@##" 1`] = `
|
|
252
|
-
Object {
|
|
253
|
-
"maximumFractionDigits": 2,
|
|
254
|
-
"maximumSignificantDigits": 3,
|
|
255
|
-
"minimumFractionDigits": 2,
|
|
256
|
-
"minimumSignificantDigits": 1,
|
|
257
|
-
"style": "percent",
|
|
258
|
-
}
|
|
259
|
-
`;
|
|
260
|
-
|
|
261
|
-
exports[`[parseNumberSkeleton] case: "percent .00/@@@" 1`] = `
|
|
262
|
-
Object {
|
|
263
|
-
"maximumFractionDigits": 2,
|
|
264
|
-
"maximumSignificantDigits": 3,
|
|
265
|
-
"minimumFractionDigits": 2,
|
|
266
|
-
"minimumSignificantDigits": 3,
|
|
267
|
-
"style": "percent",
|
|
268
|
-
}
|
|
269
|
-
`;
|
|
270
|
-
|
|
271
|
-
exports[`[parseNumberSkeleton] case: "percent .00/@@@@*" 1`] = `
|
|
272
|
-
Object {
|
|
273
|
-
"maximumFractionDigits": 2,
|
|
274
|
-
"minimumFractionDigits": 2,
|
|
275
|
-
"style": "percent",
|
|
276
|
-
}
|
|
277
|
-
`;
|
|
278
|
-
|
|
279
|
-
exports[`[parseNumberSkeleton] case: "percent .000*" 1`] = `
|
|
280
|
-
Object {
|
|
281
|
-
"minimumFractionDigits": 3,
|
|
282
|
-
"style": "percent",
|
|
283
|
-
}
|
|
284
|
-
`;
|
|
285
|
-
|
|
286
|
-
exports[`[parseNumberSkeleton] case: "percent scale/0.01" 1`] = `
|
|
287
|
-
Object {
|
|
288
|
-
"scale": 0.01,
|
|
289
|
-
"style": "percent",
|
|
290
|
-
}
|
|
291
|
-
`;
|
|
292
|
-
|
|
293
|
-
exports[`[parseNumberSkeleton] case: "scientific" 1`] = `
|
|
294
|
-
Object {
|
|
295
|
-
"notation": "scientific",
|
|
296
|
-
}
|
|
297
|
-
`;
|
|
298
|
-
|
|
299
|
-
exports[`[parseNumberSkeleton] case: "scientific/+ee/sign-always" 1`] = `
|
|
300
|
-
Object {
|
|
301
|
-
"notation": "scientific",
|
|
302
|
-
"signDisplay": "always",
|
|
303
|
-
}
|
|
304
|
-
`;
|
|
305
|
-
|
|
306
|
-
exports[`[parseNumberSkeleton] case: "scientific/sign-always" 1`] = `
|
|
307
|
-
Object {
|
|
308
|
-
"notation": "scientific",
|
|
309
|
-
"signDisplay": "always",
|
|
310
|
-
}
|
|
311
|
-
`;
|
|
312
|
-
|
|
313
|
-
exports[`[parseNumberSkeleton] case: "sign-accounting" 1`] = `
|
|
314
|
-
Object {
|
|
315
|
-
"currencySign": "accounting",
|
|
316
|
-
}
|
|
317
|
-
`;
|
|
318
|
-
|
|
319
|
-
exports[`[parseNumberSkeleton] case: "sign-accounting-always" 1`] = `
|
|
320
|
-
Object {
|
|
321
|
-
"currencySign": "accounting",
|
|
322
|
-
"signDisplay": "always",
|
|
323
|
-
}
|
|
324
|
-
`;
|
|
325
|
-
|
|
326
|
-
exports[`[parseNumberSkeleton] case: "sign-accounting-except-zero" 1`] = `
|
|
327
|
-
Object {
|
|
328
|
-
"currencySign": "accounting",
|
|
329
|
-
"signDisplay": "exceptZero",
|
|
330
|
-
}
|
|
331
|
-
`;
|
|
332
|
-
|
|
333
|
-
exports[`[parseNumberSkeleton] case: "sign-always" 1`] = `
|
|
334
|
-
Object {
|
|
335
|
-
"signDisplay": "always",
|
|
336
|
-
}
|
|
337
|
-
`;
|
|
338
|
-
|
|
339
|
-
exports[`[parseNumberSkeleton] case: "sign-auto" 1`] = `
|
|
340
|
-
Object {
|
|
341
|
-
"signDisplay": "auto",
|
|
342
|
-
}
|
|
343
|
-
`;
|
|
344
|
-
|
|
345
|
-
exports[`[parseNumberSkeleton] case: "sign-except-zero" 1`] = `
|
|
346
|
-
Object {
|
|
347
|
-
"signDisplay": "exceptZero",
|
|
348
|
-
}
|
|
349
|
-
`;
|
|
350
|
-
|
|
351
|
-
exports[`[parseNumberSkeleton] case: "sign-never" 1`] = `
|
|
352
|
-
Object {
|
|
353
|
-
"signDisplay": "never",
|
|
354
|
-
}
|
|
355
|
-
`;
|
|
356
|
-
|
|
357
|
-
exports[`case: "" 1`] = `Object {}`;
|
|
358
|
-
|
|
359
|
-
exports[`case: "EEE, MMM d, ''yy" 1`] = `
|
|
360
|
-
Object {
|
|
361
|
-
"day": "numeric",
|
|
362
|
-
"month": "short",
|
|
363
|
-
"weekday": "short",
|
|
364
|
-
"year": "2-digit",
|
|
365
|
-
}
|
|
366
|
-
`;
|
|
367
|
-
|
|
368
|
-
exports[`case: "h:mm a" 1`] = `
|
|
369
|
-
Object {
|
|
370
|
-
"hour": "numeric",
|
|
371
|
-
"hour12": true,
|
|
372
|
-
"hourCycle": "h12",
|
|
373
|
-
"minute": "2-digit",
|
|
374
|
-
}
|
|
375
|
-
`;
|
|
376
|
-
|
|
377
|
-
exports[`case: "yyyy.MM.dd G 'at' HH:mm:ss zzzz" 1`] = `
|
|
378
|
-
Object {
|
|
379
|
-
"day": "2-digit",
|
|
380
|
-
"era": "short",
|
|
381
|
-
"hour": "2-digit",
|
|
382
|
-
"hourCycle": "h23",
|
|
383
|
-
"minute": "2-digit",
|
|
384
|
-
"month": "2-digit",
|
|
385
|
-
"second": "2-digit",
|
|
386
|
-
"timeZoneName": "long",
|
|
387
|
-
"year": "numeric",
|
|
388
|
-
}
|
|
389
|
-
`;
|
package/tests/index.test.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {parseDateTimeSkeleton, parseNumberSkeleton} from '..'
|
|
2
|
-
import {parseNumberSkeletonFromString} from '../number'
|
|
3
|
-
|
|
4
|
-
test.each([
|
|
5
|
-
`yyyy.MM.dd G 'at' HH:mm:ss zzzz`,
|
|
6
|
-
`EEE, MMM d, ''yy`,
|
|
7
|
-
`h:mm a`,
|
|
8
|
-
``,
|
|
9
|
-
])('case: %p', skeleton => {
|
|
10
|
-
expect(parseDateTimeSkeleton(skeleton)).toMatchSnapshot()
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
test.each([
|
|
14
|
-
'percent .##',
|
|
15
|
-
'.##',
|
|
16
|
-
'.##/w',
|
|
17
|
-
'.',
|
|
18
|
-
'% .##',
|
|
19
|
-
'.##/@##r',
|
|
20
|
-
'.##/@##s',
|
|
21
|
-
'percent .000*',
|
|
22
|
-
'percent .0###',
|
|
23
|
-
'percent .00/@##',
|
|
24
|
-
'percent .00/@@@',
|
|
25
|
-
'percent .00/@@@@*',
|
|
26
|
-
'percent scale/0.01',
|
|
27
|
-
'currency/CAD .',
|
|
28
|
-
'.00/w currency/CAD',
|
|
29
|
-
'currency/GBP .0*/@@@',
|
|
30
|
-
'currency/GBP .00##/@@@',
|
|
31
|
-
'currency/GBP .00##/@@@ unit-width-full-name',
|
|
32
|
-
'measure-unit/length-meter .00##/@@@',
|
|
33
|
-
'measure-unit/length-meter .00##/@@@ unit-width-full-name',
|
|
34
|
-
'compact-short',
|
|
35
|
-
'compact-long',
|
|
36
|
-
'scientific',
|
|
37
|
-
'scientific/sign-always',
|
|
38
|
-
'scientific/+ee/sign-always',
|
|
39
|
-
'engineering',
|
|
40
|
-
'engineering/sign-except-zero',
|
|
41
|
-
'notation-simple',
|
|
42
|
-
'sign-auto',
|
|
43
|
-
'sign-always',
|
|
44
|
-
'+!',
|
|
45
|
-
'sign-never',
|
|
46
|
-
'+_',
|
|
47
|
-
'sign-accounting',
|
|
48
|
-
'()',
|
|
49
|
-
'sign-accounting-always',
|
|
50
|
-
'()!',
|
|
51
|
-
'sign-except-zero',
|
|
52
|
-
'+?',
|
|
53
|
-
'sign-accounting-except-zero',
|
|
54
|
-
'()?',
|
|
55
|
-
'000',
|
|
56
|
-
'integer-width/*000',
|
|
57
|
-
'E0',
|
|
58
|
-
'E+!00',
|
|
59
|
-
'EE+?000',
|
|
60
|
-
'%x100',
|
|
61
|
-
])('[parseNumberSkeleton] case: %p', skeleton => {
|
|
62
|
-
expect(
|
|
63
|
-
parseNumberSkeleton(parseNumberSkeletonFromString(skeleton))
|
|
64
|
-
).toMatchSnapshot()
|
|
65
|
-
})
|