1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var TYPE;
|
4 | (function (TYPE) {
|
5 | |
6 |
|
7 |
|
8 | TYPE[TYPE["literal"] = 0] = "literal";
|
9 | |
10 |
|
11 |
|
12 | TYPE[TYPE["argument"] = 1] = "argument";
|
13 | |
14 |
|
15 |
|
16 | TYPE[TYPE["number"] = 2] = "number";
|
17 | |
18 |
|
19 |
|
20 | TYPE[TYPE["date"] = 3] = "date";
|
21 | |
22 |
|
23 |
|
24 | TYPE[TYPE["time"] = 4] = "time";
|
25 | |
26 |
|
27 |
|
28 | TYPE[TYPE["select"] = 5] = "select";
|
29 | |
30 |
|
31 |
|
32 | TYPE[TYPE["plural"] = 6] = "plural";
|
33 | })(TYPE = exports.TYPE || (exports.TYPE = {}));
|
34 |
|
35 |
|
36 |
|
37 | function isLiteralElement(el) {
|
38 | return el.type === TYPE.literal;
|
39 | }
|
40 | exports.isLiteralElement = isLiteralElement;
|
41 | function isArgumentElement(el) {
|
42 | return el.type === TYPE.argument;
|
43 | }
|
44 | exports.isArgumentElement = isArgumentElement;
|
45 | function isNumberElement(el) {
|
46 | return el.type === TYPE.number;
|
47 | }
|
48 | exports.isNumberElement = isNumberElement;
|
49 | function isDateElement(el) {
|
50 | return el.type === TYPE.date;
|
51 | }
|
52 | exports.isDateElement = isDateElement;
|
53 | function isTimeElement(el) {
|
54 | return el.type === TYPE.time;
|
55 | }
|
56 | exports.isTimeElement = isTimeElement;
|
57 | function isSelectElement(el) {
|
58 | return el.type === TYPE.select;
|
59 | }
|
60 | exports.isSelectElement = isSelectElement;
|
61 | function isPluralElement(el) {
|
62 | return el.type === TYPE.plural;
|
63 | }
|
64 | exports.isPluralElement = isPluralElement;
|
65 | function isNumberSkeleton(el) {
|
66 | return !!(el && typeof el === 'object' && el.type === 0 );
|
67 | }
|
68 | exports.isNumberSkeleton = isNumberSkeleton;
|
69 | function isDateTimeSkeleton(el) {
|
70 | return !!(el && typeof el === 'object' && el.type === 1 );
|
71 | }
|
72 | exports.isDateTimeSkeleton = isDateTimeSkeleton;
|
73 | function createLiteralElement(value) {
|
74 | return {
|
75 | type: TYPE.literal,
|
76 | value: value,
|
77 | };
|
78 | }
|
79 | exports.createLiteralElement = createLiteralElement;
|
80 | function createNumberElement(value, style) {
|
81 | return {
|
82 | type: TYPE.number,
|
83 | value: value,
|
84 | style: style,
|
85 | };
|
86 | }
|
87 | exports.createNumberElement = createNumberElement;
|