@formatjs/ecma402-abstract 1.7.1 → 1.9.2
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/NumberFormat/format_to_parts.d.ts.map +1 -1
- package/NumberFormat/format_to_parts.js +3 -3
- package/index.d.ts +1 -23
- package/index.d.ts.map +1 -1
- package/index.js +13 -38
- package/lib/NumberFormat/format_to_parts.d.ts.map +1 -1
- package/lib/NumberFormat/format_to_parts.js +1 -1
- package/lib/index.d.ts +1 -23
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -23
- 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/lib/types/date-time.d.ts +2 -1
- package/lib/types/date-time.d.ts.map +1 -1
- package/package.json +1 -1
- package/regex.generated.d.ts +2 -0
- package/regex.generated.d.ts.map +1 -0
- package/regex.generated.js +5 -0
- package/types/date-time.d.ts +2 -1
- package/types/date-time.d.ts.map +1 -1
- package/DateTimeFormat/BasicFormatMatcher.d.ts +0 -8
- package/DateTimeFormat/BasicFormatMatcher.d.ts.map +0 -1
- package/DateTimeFormat/BasicFormatMatcher.js +0 -61
- package/DateTimeFormat/BestFitFormatMatcher.d.ts +0 -17
- package/DateTimeFormat/BestFitFormatMatcher.d.ts.map +0 -1
- package/DateTimeFormat/BestFitFormatMatcher.js +0 -121
- package/DateTimeFormat/DateTimeStyleFormat.d.ts +0 -3
- package/DateTimeFormat/DateTimeStyleFormat.d.ts.map +0 -1
- package/DateTimeFormat/DateTimeStyleFormat.js +0 -54
- package/DateTimeFormat/FormatDateTime.d.ts +0 -8
- package/DateTimeFormat/FormatDateTime.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTime.js +0 -19
- package/DateTimeFormat/FormatDateTimePattern.d.ts +0 -14
- package/DateTimeFormat/FormatDateTimePattern.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTimePattern.js +0 -182
- package/DateTimeFormat/FormatDateTimeRange.d.ts +0 -4
- package/DateTimeFormat/FormatDateTimeRange.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTimeRange.js +0 -14
- package/DateTimeFormat/FormatDateTimeRangeToParts.d.ts +0 -4
- package/DateTimeFormat/FormatDateTimeRangeToParts.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTimeRangeToParts.js +0 -18
- package/DateTimeFormat/FormatDateTimeToParts.d.ts +0 -11
- package/DateTimeFormat/FormatDateTimeToParts.d.ts.map +0 -1
- package/DateTimeFormat/FormatDateTimeToParts.js +0 -25
- package/DateTimeFormat/InitializeDateTimeFormat.d.ts +0 -18
- package/DateTimeFormat/InitializeDateTimeFormat.d.ts.map +0 -1
- package/DateTimeFormat/InitializeDateTimeFormat.js +0 -188
- package/DateTimeFormat/PartitionDateTimePattern.d.ts +0 -10
- package/DateTimeFormat/PartitionDateTimePattern.d.ts.map +0 -1
- package/DateTimeFormat/PartitionDateTimePattern.js +0 -24
- package/DateTimeFormat/PartitionDateTimeRangePattern.d.ts +0 -5
- package/DateTimeFormat/PartitionDateTimeRangePattern.d.ts.map +0 -1
- package/DateTimeFormat/PartitionDateTimeRangePattern.js +0 -128
- package/DateTimeFormat/ToDateTimeOptions.d.ts +0 -9
- package/DateTimeFormat/ToDateTimeOptions.d.ts.map +0 -1
- package/DateTimeFormat/ToDateTimeOptions.js +0 -67
- package/DateTimeFormat/ToLocalTime.d.ts +0 -26
- package/DateTimeFormat/ToLocalTime.d.ts.map +0 -1
- package/DateTimeFormat/ToLocalTime.js +0 -55
- package/DateTimeFormat/skeleton.d.ts +0 -14
- package/DateTimeFormat/skeleton.d.ts.map +0 -1
- package/DateTimeFormat/skeleton.js +0 -301
- package/DateTimeFormat/utils.d.ts +0 -10
- package/DateTimeFormat/utils.d.ts.map +0 -1
- package/DateTimeFormat/utils.js +0 -21
- package/DisplayNames/CanonicalCodeForDisplayNames.d.ts +0 -2
- package/DisplayNames/CanonicalCodeForDisplayNames.d.ts.map +0 -1
- package/DisplayNames/CanonicalCodeForDisplayNames.js +0 -37
- package/PluralRules/GetOperands.d.ts +0 -32
- package/PluralRules/GetOperands.d.ts.map +0 -1
- package/PluralRules/GetOperands.js +0 -51
- package/PluralRules/InitializePluralRules.d.ts +0 -9
- package/PluralRules/InitializePluralRules.d.ts.map +0 -1
- package/PluralRules/InitializePluralRules.js +0 -24
- package/PluralRules/ResolvePlural.d.ts +0 -13
- package/PluralRules/ResolvePlural.d.ts.map +0 -1
- package/PluralRules/ResolvePlural.js +0 -29
- package/RelativeTimeFormat/FormatRelativeTime.d.ts +0 -5
- package/RelativeTimeFormat/FormatRelativeTime.d.ts.map +0 -1
- package/RelativeTimeFormat/FormatRelativeTime.js +0 -14
- package/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts +0 -5
- package/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts.map +0 -1
- package/RelativeTimeFormat/FormatRelativeTimeToParts.js +0 -22
- package/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts +0 -9
- package/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts.map +0 -1
- package/RelativeTimeFormat/InitializeRelativeTimeFormat.js +0 -41
- package/RelativeTimeFormat/MakePartsList.d.ts +0 -2
- package/RelativeTimeFormat/MakePartsList.d.ts.map +0 -1
- package/RelativeTimeFormat/MakePartsList.js +0 -31
- package/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts +0 -5
- package/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts.map +0 -1
- package/RelativeTimeFormat/PartitionRelativeTimePattern.js +0 -58
- package/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts +0 -7
- package/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts.map +0 -1
- package/RelativeTimeFormat/SingularRelativeTimeUnit.js +0 -40
- package/lib/DateTimeFormat/BasicFormatMatcher.d.ts +0 -8
- package/lib/DateTimeFormat/BasicFormatMatcher.d.ts.map +0 -1
- package/lib/DateTimeFormat/BasicFormatMatcher.js +0 -57
- package/lib/DateTimeFormat/BestFitFormatMatcher.d.ts +0 -17
- package/lib/DateTimeFormat/BestFitFormatMatcher.d.ts.map +0 -1
- package/lib/DateTimeFormat/BestFitFormatMatcher.js +0 -116
- package/lib/DateTimeFormat/DateTimeStyleFormat.d.ts +0 -3
- package/lib/DateTimeFormat/DateTimeStyleFormat.d.ts.map +0 -1
- package/lib/DateTimeFormat/DateTimeStyleFormat.js +0 -50
- package/lib/DateTimeFormat/FormatDateTime.d.ts +0 -8
- package/lib/DateTimeFormat/FormatDateTime.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTime.js +0 -15
- package/lib/DateTimeFormat/FormatDateTimePattern.d.ts +0 -14
- package/lib/DateTimeFormat/FormatDateTimePattern.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTimePattern.js +0 -178
- package/lib/DateTimeFormat/FormatDateTimeRange.d.ts +0 -4
- package/lib/DateTimeFormat/FormatDateTimeRange.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTimeRange.js +0 -10
- package/lib/DateTimeFormat/FormatDateTimeRangeToParts.d.ts +0 -4
- package/lib/DateTimeFormat/FormatDateTimeRangeToParts.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTimeRangeToParts.js +0 -14
- package/lib/DateTimeFormat/FormatDateTimeToParts.d.ts +0 -11
- package/lib/DateTimeFormat/FormatDateTimeToParts.d.ts.map +0 -1
- package/lib/DateTimeFormat/FormatDateTimeToParts.js +0 -21
- package/lib/DateTimeFormat/InitializeDateTimeFormat.d.ts +0 -18
- package/lib/DateTimeFormat/InitializeDateTimeFormat.d.ts.map +0 -1
- package/lib/DateTimeFormat/InitializeDateTimeFormat.js +0 -184
- package/lib/DateTimeFormat/PartitionDateTimePattern.d.ts +0 -10
- package/lib/DateTimeFormat/PartitionDateTimePattern.d.ts.map +0 -1
- package/lib/DateTimeFormat/PartitionDateTimePattern.js +0 -20
- package/lib/DateTimeFormat/PartitionDateTimeRangePattern.d.ts +0 -5
- package/lib/DateTimeFormat/PartitionDateTimeRangePattern.d.ts.map +0 -1
- package/lib/DateTimeFormat/PartitionDateTimeRangePattern.js +0 -124
- package/lib/DateTimeFormat/ToDateTimeOptions.d.ts +0 -9
- package/lib/DateTimeFormat/ToDateTimeOptions.d.ts.map +0 -1
- package/lib/DateTimeFormat/ToDateTimeOptions.js +0 -63
- package/lib/DateTimeFormat/ToLocalTime.d.ts +0 -26
- package/lib/DateTimeFormat/ToLocalTime.d.ts.map +0 -1
- package/lib/DateTimeFormat/ToLocalTime.js +0 -51
- package/lib/DateTimeFormat/skeleton.d.ts +0 -14
- package/lib/DateTimeFormat/skeleton.d.ts.map +0 -1
- package/lib/DateTimeFormat/skeleton.js +0 -294
- package/lib/DateTimeFormat/utils.d.ts +0 -10
- package/lib/DateTimeFormat/utils.d.ts.map +0 -1
- package/lib/DateTimeFormat/utils.js +0 -18
- package/lib/DisplayNames/CanonicalCodeForDisplayNames.d.ts +0 -2
- package/lib/DisplayNames/CanonicalCodeForDisplayNames.d.ts.map +0 -1
- package/lib/DisplayNames/CanonicalCodeForDisplayNames.js +0 -33
- package/lib/PluralRules/GetOperands.d.ts +0 -32
- package/lib/PluralRules/GetOperands.d.ts.map +0 -1
- package/lib/PluralRules/GetOperands.js +0 -47
- package/lib/PluralRules/InitializePluralRules.d.ts +0 -9
- package/lib/PluralRules/InitializePluralRules.d.ts.map +0 -1
- package/lib/PluralRules/InitializePluralRules.js +0 -20
- package/lib/PluralRules/ResolvePlural.d.ts +0 -13
- package/lib/PluralRules/ResolvePlural.d.ts.map +0 -1
- package/lib/PluralRules/ResolvePlural.js +0 -25
- package/lib/RelativeTimeFormat/FormatRelativeTime.d.ts +0 -5
- package/lib/RelativeTimeFormat/FormatRelativeTime.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/FormatRelativeTime.js +0 -10
- package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts +0 -5
- package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/FormatRelativeTimeToParts.js +0 -18
- package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts +0 -9
- package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/InitializeRelativeTimeFormat.js +0 -37
- package/lib/RelativeTimeFormat/MakePartsList.d.ts +0 -2
- package/lib/RelativeTimeFormat/MakePartsList.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/MakePartsList.js +0 -27
- package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts +0 -5
- package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/PartitionRelativeTimePattern.js +0 -54
- package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts +0 -7
- package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.d.ts.map +0 -1
- package/lib/RelativeTimeFormat/SingularRelativeTimeUnit.js +0 -36
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { ToObject } from '../262';
|
|
2
|
-
/**
|
|
3
|
-
* https://tc39.es/ecma402/#sec-todatetimeoptions
|
|
4
|
-
* @param options
|
|
5
|
-
* @param required
|
|
6
|
-
* @param defaults
|
|
7
|
-
*/
|
|
8
|
-
export function ToDateTimeOptions(options, required, defaults) {
|
|
9
|
-
if (options === undefined) {
|
|
10
|
-
options = null;
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
options = ToObject(options);
|
|
14
|
-
}
|
|
15
|
-
options = Object.create(options);
|
|
16
|
-
var needDefaults = true;
|
|
17
|
-
if (required === 'date' || required === 'any') {
|
|
18
|
-
for (var _i = 0, _a = ['weekday', 'year', 'month', 'day']; _i < _a.length; _i++) {
|
|
19
|
-
var prop = _a[_i];
|
|
20
|
-
var value = options[prop];
|
|
21
|
-
if (value !== undefined) {
|
|
22
|
-
needDefaults = false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (required === 'time' || required === 'any') {
|
|
27
|
-
for (var _b = 0, _c = [
|
|
28
|
-
'dayPeriod',
|
|
29
|
-
'hour',
|
|
30
|
-
'minute',
|
|
31
|
-
'second',
|
|
32
|
-
'fractionalSecondDigits',
|
|
33
|
-
]; _b < _c.length; _b++) {
|
|
34
|
-
var prop = _c[_b];
|
|
35
|
-
var value = options[prop];
|
|
36
|
-
if (value !== undefined) {
|
|
37
|
-
needDefaults = false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (options.dateStyle !== undefined || options.timeStyle !== undefined) {
|
|
42
|
-
needDefaults = false;
|
|
43
|
-
}
|
|
44
|
-
if (required === 'date' && options.timeStyle) {
|
|
45
|
-
throw new TypeError('Intl.DateTimeFormat date was required but timeStyle was included');
|
|
46
|
-
}
|
|
47
|
-
if (required === 'time' && options.dateStyle) {
|
|
48
|
-
throw new TypeError('Intl.DateTimeFormat time was required but dateStyle was included');
|
|
49
|
-
}
|
|
50
|
-
if (needDefaults && (defaults === 'date' || defaults === 'all')) {
|
|
51
|
-
for (var _d = 0, _e = ['year', 'month', 'day']; _d < _e.length; _d++) {
|
|
52
|
-
var prop = _e[_d];
|
|
53
|
-
options[prop] = 'numeric';
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (needDefaults && (defaults === 'time' || defaults === 'all')) {
|
|
57
|
-
for (var _f = 0, _g = ['hour', 'minute', 'second']; _f < _g.length; _f++) {
|
|
58
|
-
var prop = _g[_f];
|
|
59
|
-
options[prop] = 'numeric';
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return options;
|
|
63
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { UnpackedZoneData } from '../types/date-time';
|
|
2
|
-
export interface ToLocalTimeImplDetails {
|
|
3
|
-
tzData: Record<string, UnpackedZoneData[]>;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* https://tc39.es/ecma402/#sec-tolocaltime
|
|
7
|
-
* @param t
|
|
8
|
-
* @param calendar
|
|
9
|
-
* @param timeZone
|
|
10
|
-
*/
|
|
11
|
-
export declare function ToLocalTime(t: number, calendar: string, timeZone: string, { tzData }: ToLocalTimeImplDetails): {
|
|
12
|
-
weekday: number;
|
|
13
|
-
era: string;
|
|
14
|
-
year: number;
|
|
15
|
-
relatedYear: undefined;
|
|
16
|
-
yearName: undefined;
|
|
17
|
-
month: number;
|
|
18
|
-
day: number;
|
|
19
|
-
hour: number;
|
|
20
|
-
minute: number;
|
|
21
|
-
second: number;
|
|
22
|
-
millisecond: number;
|
|
23
|
-
inDST: boolean;
|
|
24
|
-
timeZoneOffset: number;
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=ToLocalTime.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToLocalTime.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/ToLocalTime.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAmCnD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAA;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,EAAC,MAAM,EAAC,EAAE,sBAAsB,GAC/B;IACD,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,SAAS,CAAA;IACtB,QAAQ,EAAE,SAAS,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB,CA0BA"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { invariant } from '../utils';
|
|
2
|
-
import { Type, YearFromTime, WeekDay, MonthFromTime, DateFromTime, HourFromTime, MinFromTime, SecFromTime, msFromTime, } from '../262';
|
|
3
|
-
function getApplicableZoneData(t, timeZone, tzData) {
|
|
4
|
-
var _a;
|
|
5
|
-
var zoneData = tzData[timeZone];
|
|
6
|
-
// We don't have data for this so just say it's UTC
|
|
7
|
-
if (!zoneData) {
|
|
8
|
-
return [0, false];
|
|
9
|
-
}
|
|
10
|
-
var i = 0;
|
|
11
|
-
var offset = 0;
|
|
12
|
-
var dst = false;
|
|
13
|
-
for (; i <= zoneData.length; i++) {
|
|
14
|
-
if (i === zoneData.length || zoneData[i][0] * 1e3 > t) {
|
|
15
|
-
;
|
|
16
|
-
_a = zoneData[i - 1], offset = _a[2], dst = _a[3];
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return [offset * 1e3, dst];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* https://tc39.es/ecma402/#sec-tolocaltime
|
|
24
|
-
* @param t
|
|
25
|
-
* @param calendar
|
|
26
|
-
* @param timeZone
|
|
27
|
-
*/
|
|
28
|
-
export function ToLocalTime(t, calendar, timeZone, _a) {
|
|
29
|
-
var tzData = _a.tzData;
|
|
30
|
-
invariant(Type(t) === 'Number', 'invalid time');
|
|
31
|
-
invariant(calendar === 'gregory', 'We only support Gregory calendar right now');
|
|
32
|
-
var _b = getApplicableZoneData(t, timeZone, tzData), timeZoneOffset = _b[0], inDST = _b[1];
|
|
33
|
-
var tz = t + timeZoneOffset;
|
|
34
|
-
var year = YearFromTime(tz);
|
|
35
|
-
return {
|
|
36
|
-
weekday: WeekDay(tz),
|
|
37
|
-
era: year < 0 ? 'BC' : 'AD',
|
|
38
|
-
year: year,
|
|
39
|
-
relatedYear: undefined,
|
|
40
|
-
yearName: undefined,
|
|
41
|
-
month: MonthFromTime(tz),
|
|
42
|
-
day: DateFromTime(tz),
|
|
43
|
-
hour: HourFromTime(tz),
|
|
44
|
-
minute: MinFromTime(tz),
|
|
45
|
-
second: SecFromTime(tz),
|
|
46
|
-
millisecond: msFromTime(tz),
|
|
47
|
-
inDST: inDST,
|
|
48
|
-
// IMPORTANT: Not in spec
|
|
49
|
-
timeZoneOffset: timeZoneOffset,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DateTimeFormatOptions, Formats, RangePatternPart } from '../types/date-time';
|
|
2
|
-
export declare function processDateTimePattern(pattern: string, result?: Pick<DateTimeFormatOptions, 'weekday' | 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'timeZoneName'> & {
|
|
3
|
-
hour12?: boolean;
|
|
4
|
-
}): [string, string];
|
|
5
|
-
/**
|
|
6
|
-
* Parse Date time skeleton into Intl.DateTimeFormatOptions
|
|
7
|
-
* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
8
|
-
* @public
|
|
9
|
-
* @param skeleton skeleton string
|
|
10
|
-
*/
|
|
11
|
-
export declare function parseDateTimeSkeleton(skeleton: string, rawPattern?: string, rangePatterns?: Record<string, string>, intervalFormatFallback?: string): Formats;
|
|
12
|
-
export declare function splitFallbackRangePattern(pattern: string): Array<RangePatternPart>;
|
|
13
|
-
export declare function splitRangePattern(pattern: string): Array<RangePatternPart>;
|
|
14
|
-
//# sourceMappingURL=skeleton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/skeleton.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,gBAAgB,EAIjB,MAAM,oBAAoB,CAAA;AAkN3B,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,IAAI,CACX,qBAAqB,EACnB,SAAS,GACT,KAAK,GACL,MAAM,GACN,OAAO,GACP,KAAK,GACL,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,cAAc,CACjB,GAAG;IACF,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,GACA,CAAC,MAAM,EAAE,MAAM,CAAC,CA8BlB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,UAAU,GAAE,MAAiB,EAC7B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CA+CT;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,GACd,KAAK,CAAC,gBAAgB,CAAC,CAqBzB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAgC1E"}
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import { RangePatternType, } from '../types/date-time';
|
|
3
|
-
/**
|
|
4
|
-
* https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
5
|
-
* Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js
|
|
6
|
-
* with some tweaks
|
|
7
|
-
*/
|
|
8
|
-
var DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
|
|
9
|
-
// trim patterns after transformations
|
|
10
|
-
var expPatternTrimmer = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
|
|
11
|
-
function matchSkeletonPattern(match, result) {
|
|
12
|
-
var len = match.length;
|
|
13
|
-
switch (match[0]) {
|
|
14
|
-
// Era
|
|
15
|
-
case 'G':
|
|
16
|
-
result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';
|
|
17
|
-
return '{era}';
|
|
18
|
-
// Year
|
|
19
|
-
case 'y':
|
|
20
|
-
case 'Y':
|
|
21
|
-
case 'u':
|
|
22
|
-
case 'U':
|
|
23
|
-
case 'r':
|
|
24
|
-
result.year = len === 2 ? '2-digit' : 'numeric';
|
|
25
|
-
return '{year}';
|
|
26
|
-
// Quarter
|
|
27
|
-
case 'q':
|
|
28
|
-
case 'Q':
|
|
29
|
-
throw new RangeError('`w/Q` (quarter) patterns are not supported');
|
|
30
|
-
// Month
|
|
31
|
-
case 'M':
|
|
32
|
-
case 'L':
|
|
33
|
-
result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];
|
|
34
|
-
return '{month}';
|
|
35
|
-
// Week
|
|
36
|
-
case 'w':
|
|
37
|
-
case 'W':
|
|
38
|
-
throw new RangeError('`w/W` (week of year) patterns are not supported');
|
|
39
|
-
case 'd':
|
|
40
|
-
result.day = ['numeric', '2-digit'][len - 1];
|
|
41
|
-
return '{day}';
|
|
42
|
-
case 'D':
|
|
43
|
-
case 'F':
|
|
44
|
-
case 'g':
|
|
45
|
-
result.day = 'numeric';
|
|
46
|
-
return '{day}';
|
|
47
|
-
// Weekday
|
|
48
|
-
case 'E':
|
|
49
|
-
result.weekday = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';
|
|
50
|
-
return '{weekday}';
|
|
51
|
-
case 'e':
|
|
52
|
-
result.weekday = [
|
|
53
|
-
undefined,
|
|
54
|
-
undefined,
|
|
55
|
-
'short',
|
|
56
|
-
'long',
|
|
57
|
-
'narrow',
|
|
58
|
-
'short',
|
|
59
|
-
][len - 1];
|
|
60
|
-
return '{weekday}';
|
|
61
|
-
case 'c':
|
|
62
|
-
result.weekday = [
|
|
63
|
-
undefined,
|
|
64
|
-
undefined,
|
|
65
|
-
'short',
|
|
66
|
-
'long',
|
|
67
|
-
'narrow',
|
|
68
|
-
'short',
|
|
69
|
-
][len - 1];
|
|
70
|
-
return '{weekday}';
|
|
71
|
-
// Period
|
|
72
|
-
case 'a': // AM, PM
|
|
73
|
-
case 'b': // am, pm, noon, midnight
|
|
74
|
-
case 'B': // flexible day periods
|
|
75
|
-
result.hour12 = true;
|
|
76
|
-
return '{ampm}';
|
|
77
|
-
// Hour
|
|
78
|
-
case 'h':
|
|
79
|
-
result.hour = ['numeric', '2-digit'][len - 1];
|
|
80
|
-
result.hour12 = true;
|
|
81
|
-
return '{hour}';
|
|
82
|
-
case 'H':
|
|
83
|
-
result.hour = ['numeric', '2-digit'][len - 1];
|
|
84
|
-
return '{hour}';
|
|
85
|
-
case 'K':
|
|
86
|
-
result.hour = ['numeric', '2-digit'][len - 1];
|
|
87
|
-
result.hour12 = true;
|
|
88
|
-
return '{hour}';
|
|
89
|
-
case 'k':
|
|
90
|
-
result.hour = ['numeric', '2-digit'][len - 1];
|
|
91
|
-
return '{hour}';
|
|
92
|
-
case 'j':
|
|
93
|
-
case 'J':
|
|
94
|
-
case 'C':
|
|
95
|
-
throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');
|
|
96
|
-
// Minute
|
|
97
|
-
case 'm':
|
|
98
|
-
result.minute = ['numeric', '2-digit'][len - 1];
|
|
99
|
-
return '{minute}';
|
|
100
|
-
// Second
|
|
101
|
-
case 's':
|
|
102
|
-
result.second = ['numeric', '2-digit'][len - 1];
|
|
103
|
-
return '{second}';
|
|
104
|
-
case 'S':
|
|
105
|
-
case 'A':
|
|
106
|
-
result.second = 'numeric';
|
|
107
|
-
return '{second}';
|
|
108
|
-
// Zone
|
|
109
|
-
case 'z': // 1..3, 4: specific non-location format
|
|
110
|
-
case 'Z': // 1..3, 4, 5: The ISO8601 varios formats
|
|
111
|
-
case 'O': // 1, 4: miliseconds in day short, long
|
|
112
|
-
case 'v': // 1, 4: generic non-location format
|
|
113
|
-
case 'V': // 1, 2, 3, 4: time zone ID or city
|
|
114
|
-
case 'X': // 1, 2, 3, 4: The ISO8601 varios formats
|
|
115
|
-
case 'x': // 1, 2, 3, 4: The ISO8601 varios formats
|
|
116
|
-
result.timeZoneName = len < 4 ? 'short' : 'long';
|
|
117
|
-
return '{timeZoneName}';
|
|
118
|
-
}
|
|
119
|
-
return '';
|
|
120
|
-
}
|
|
121
|
-
function skeletonTokenToTable2(c) {
|
|
122
|
-
switch (c) {
|
|
123
|
-
// Era
|
|
124
|
-
case 'G':
|
|
125
|
-
return 'era';
|
|
126
|
-
// Year
|
|
127
|
-
case 'y':
|
|
128
|
-
case 'Y':
|
|
129
|
-
case 'u':
|
|
130
|
-
case 'U':
|
|
131
|
-
case 'r':
|
|
132
|
-
return 'year';
|
|
133
|
-
// Month
|
|
134
|
-
case 'M':
|
|
135
|
-
case 'L':
|
|
136
|
-
return 'month';
|
|
137
|
-
// Day
|
|
138
|
-
case 'd':
|
|
139
|
-
case 'D':
|
|
140
|
-
case 'F':
|
|
141
|
-
case 'g':
|
|
142
|
-
return 'day';
|
|
143
|
-
// Period
|
|
144
|
-
case 'a': // AM, PM
|
|
145
|
-
case 'b': // am, pm, noon, midnight
|
|
146
|
-
case 'B': // flexible day periods
|
|
147
|
-
return 'ampm';
|
|
148
|
-
// Hour
|
|
149
|
-
case 'h':
|
|
150
|
-
case 'H':
|
|
151
|
-
case 'K':
|
|
152
|
-
case 'k':
|
|
153
|
-
return 'hour';
|
|
154
|
-
// Minute
|
|
155
|
-
case 'm':
|
|
156
|
-
return 'minute';
|
|
157
|
-
// Second
|
|
158
|
-
case 's':
|
|
159
|
-
case 'S':
|
|
160
|
-
case 'A':
|
|
161
|
-
return 'second';
|
|
162
|
-
default:
|
|
163
|
-
throw new RangeError('Invalid range pattern token');
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
export function processDateTimePattern(pattern, result) {
|
|
167
|
-
var literals = [];
|
|
168
|
-
// Use skeleton to populate result, but use mapped pattern to populate pattern
|
|
169
|
-
var pattern12 = pattern
|
|
170
|
-
// Double apostrophe
|
|
171
|
-
.replace(/'{2}/g, '{apostrophe}')
|
|
172
|
-
// Apostrophe-escaped
|
|
173
|
-
.replace(/'(.*?)'/g, function (_, literal) {
|
|
174
|
-
literals.push(literal);
|
|
175
|
-
return "$$" + (literals.length - 1) + "$$";
|
|
176
|
-
})
|
|
177
|
-
.replace(DATE_TIME_REGEX, function (m) { return matchSkeletonPattern(m, result || {}); });
|
|
178
|
-
//Restore literals
|
|
179
|
-
if (literals.length) {
|
|
180
|
-
pattern12 = pattern12
|
|
181
|
-
.replace(/\$\$(\d+)\$\$/g, function (_, i) {
|
|
182
|
-
return literals[+i];
|
|
183
|
-
})
|
|
184
|
-
.replace(/\{apostrophe\}/g, "'");
|
|
185
|
-
}
|
|
186
|
-
// Handle apostrophe-escaped things
|
|
187
|
-
return [
|
|
188
|
-
pattern12
|
|
189
|
-
.replace(/([\s\uFEFF\xA0])\{ampm\}([\s\uFEFF\xA0])/, '$1')
|
|
190
|
-
.replace('{ampm}', '')
|
|
191
|
-
.replace(expPatternTrimmer, ''),
|
|
192
|
-
pattern12,
|
|
193
|
-
];
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Parse Date time skeleton into Intl.DateTimeFormatOptions
|
|
197
|
-
* Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
198
|
-
* @public
|
|
199
|
-
* @param skeleton skeleton string
|
|
200
|
-
*/
|
|
201
|
-
export function parseDateTimeSkeleton(skeleton, rawPattern, rangePatterns, intervalFormatFallback) {
|
|
202
|
-
if (rawPattern === void 0) { rawPattern = skeleton; }
|
|
203
|
-
var result = {
|
|
204
|
-
pattern: '',
|
|
205
|
-
pattern12: '',
|
|
206
|
-
skeleton: skeleton,
|
|
207
|
-
rawPattern: rawPattern,
|
|
208
|
-
rangePatterns: {},
|
|
209
|
-
rangePatterns12: {},
|
|
210
|
-
};
|
|
211
|
-
if (rangePatterns) {
|
|
212
|
-
for (var k in rangePatterns) {
|
|
213
|
-
var key = skeletonTokenToTable2(k);
|
|
214
|
-
var rawPattern_1 = rangePatterns[k];
|
|
215
|
-
var intervalResult = {
|
|
216
|
-
patternParts: [],
|
|
217
|
-
};
|
|
218
|
-
var _a = processDateTimePattern(rawPattern_1, intervalResult), pattern_1 = _a[0], pattern12_1 = _a[1];
|
|
219
|
-
result.rangePatterns[key] = __assign(__assign({}, intervalResult), { patternParts: splitRangePattern(pattern_1) });
|
|
220
|
-
result.rangePatterns12[key] = __assign(__assign({}, intervalResult), { patternParts: splitRangePattern(pattern12_1) });
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
else if (intervalFormatFallback) {
|
|
224
|
-
var patternParts = splitFallbackRangePattern(intervalFormatFallback);
|
|
225
|
-
result.rangePatterns.default = {
|
|
226
|
-
patternParts: patternParts,
|
|
227
|
-
};
|
|
228
|
-
result.rangePatterns12.default = {
|
|
229
|
-
patternParts: patternParts,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
// Process skeleton
|
|
233
|
-
skeleton.replace(DATE_TIME_REGEX, function (m) { return matchSkeletonPattern(m, result); });
|
|
234
|
-
var _b = processDateTimePattern(rawPattern), pattern = _b[0], pattern12 = _b[1];
|
|
235
|
-
result.pattern = pattern;
|
|
236
|
-
result.pattern12 = pattern12;
|
|
237
|
-
return result;
|
|
238
|
-
}
|
|
239
|
-
export function splitFallbackRangePattern(pattern) {
|
|
240
|
-
var parts = pattern.split(/(\{[0|1]\})/g).filter(Boolean);
|
|
241
|
-
return parts.map(function (pattern) {
|
|
242
|
-
switch (pattern) {
|
|
243
|
-
case '{0}':
|
|
244
|
-
return {
|
|
245
|
-
source: RangePatternType.startRange,
|
|
246
|
-
pattern: pattern,
|
|
247
|
-
};
|
|
248
|
-
case '{1}':
|
|
249
|
-
return {
|
|
250
|
-
source: RangePatternType.endRange,
|
|
251
|
-
pattern: pattern,
|
|
252
|
-
};
|
|
253
|
-
default:
|
|
254
|
-
return {
|
|
255
|
-
source: RangePatternType.shared,
|
|
256
|
-
pattern: pattern,
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
export function splitRangePattern(pattern) {
|
|
262
|
-
var PART_REGEX = /\{(.*?)\}/g;
|
|
263
|
-
// Map of part and index within the string
|
|
264
|
-
var parts = {};
|
|
265
|
-
var match;
|
|
266
|
-
var splitIndex = 0;
|
|
267
|
-
while ((match = PART_REGEX.exec(pattern))) {
|
|
268
|
-
if (!(match[0] in parts)) {
|
|
269
|
-
parts[match[0]] = match.index;
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
splitIndex = match.index;
|
|
273
|
-
break;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
if (!splitIndex) {
|
|
277
|
-
return [
|
|
278
|
-
{
|
|
279
|
-
source: RangePatternType.startRange,
|
|
280
|
-
pattern: pattern,
|
|
281
|
-
},
|
|
282
|
-
];
|
|
283
|
-
}
|
|
284
|
-
return [
|
|
285
|
-
{
|
|
286
|
-
source: RangePatternType.startRange,
|
|
287
|
-
pattern: pattern.slice(0, splitIndex),
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
source: RangePatternType.endRange,
|
|
291
|
-
pattern: pattern.slice(splitIndex),
|
|
292
|
-
},
|
|
293
|
-
];
|
|
294
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IntlDateTimeFormatInternal, TABLE_6 } from '../types/date-time';
|
|
2
|
-
export declare const DATE_TIME_PROPS: Array<keyof Pick<IntlDateTimeFormatInternal, TABLE_6>>;
|
|
3
|
-
export declare const removalPenalty = 120;
|
|
4
|
-
export declare const additionPenalty = 20;
|
|
5
|
-
export declare const differentNumericTypePenalty = 15;
|
|
6
|
-
export declare const longLessPenalty = 8;
|
|
7
|
-
export declare const longMorePenalty = 6;
|
|
8
|
-
export declare const shortLessPenalty = 6;
|
|
9
|
-
export declare const shortMorePenalty = 3;
|
|
10
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DateTimeFormat/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAE,OAAO,EAAC,MAAM,oBAAoB,CAAA;AAEtE,eAAO,MAAM,eAAe,EAAE,KAAK,CACjC,MAAM,IAAI,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAWhD,CAAA;AAED,eAAO,MAAM,cAAc,MAAM,CAAA;AACjC,eAAO,MAAM,eAAe,KAAK,CAAA;AACjC,eAAO,MAAM,2BAA2B,KAAK,CAAA;AAC7C,eAAO,MAAM,eAAe,IAAI,CAAA;AAChC,eAAO,MAAM,eAAe,IAAI,CAAA;AAChC,eAAO,MAAM,gBAAgB,IAAI,CAAA;AACjC,eAAO,MAAM,gBAAgB,IAAI,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export var DATE_TIME_PROPS = [
|
|
2
|
-
'weekday',
|
|
3
|
-
'era',
|
|
4
|
-
'year',
|
|
5
|
-
'month',
|
|
6
|
-
'day',
|
|
7
|
-
'hour',
|
|
8
|
-
'minute',
|
|
9
|
-
'second',
|
|
10
|
-
'timeZoneName',
|
|
11
|
-
];
|
|
12
|
-
export var removalPenalty = 120;
|
|
13
|
-
export var additionPenalty = 20;
|
|
14
|
-
export var differentNumericTypePenalty = 15;
|
|
15
|
-
export var longLessPenalty = 8;
|
|
16
|
-
export var longMorePenalty = 6;
|
|
17
|
-
export var shortLessPenalty = 6;
|
|
18
|
-
export var shortMorePenalty = 3;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CanonicalCodeForDisplayNames.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/DisplayNames/CanonicalCodeForDisplayNames.ts"],"names":[],"mappings":"AAcA,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,EACnD,IAAI,EAAE,MAAM,GACX,MAAM,CAqBR"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CanonicalizeLocaleList } from '../CanonicalizeLocaleList';
|
|
2
|
-
import { invariant } from '../utils';
|
|
3
|
-
import { IsWellFormedCurrencyCode } from '../IsWellFormedCurrencyCode';
|
|
4
|
-
var UNICODE_REGION_SUBTAG_REGEX = /^([a-z]{2}|[0-9]{3})$/i;
|
|
5
|
-
var ALPHA_4 = /^[a-z]{4}$/i;
|
|
6
|
-
function isUnicodeRegionSubtag(region) {
|
|
7
|
-
return UNICODE_REGION_SUBTAG_REGEX.test(region);
|
|
8
|
-
}
|
|
9
|
-
function isUnicodeScriptSubtag(script) {
|
|
10
|
-
return ALPHA_4.test(script);
|
|
11
|
-
}
|
|
12
|
-
export function CanonicalCodeForDisplayNames(type, code) {
|
|
13
|
-
if (type === 'language') {
|
|
14
|
-
return CanonicalizeLocaleList([code])[0];
|
|
15
|
-
}
|
|
16
|
-
if (type === 'region') {
|
|
17
|
-
if (!isUnicodeRegionSubtag(code)) {
|
|
18
|
-
throw RangeError('invalid region');
|
|
19
|
-
}
|
|
20
|
-
return code.toUpperCase();
|
|
21
|
-
}
|
|
22
|
-
if (type === 'script') {
|
|
23
|
-
if (!isUnicodeScriptSubtag(code)) {
|
|
24
|
-
throw RangeError('invalid script');
|
|
25
|
-
}
|
|
26
|
-
return "" + code[0].toUpperCase() + code.slice(1).toLowerCase();
|
|
27
|
-
}
|
|
28
|
-
invariant(type === 'currency', 'invalid type');
|
|
29
|
-
if (!IsWellFormedCurrencyCode(code)) {
|
|
30
|
-
throw RangeError('invalid currency');
|
|
31
|
-
}
|
|
32
|
-
return code.toUpperCase();
|
|
33
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface OperandsRecord {
|
|
2
|
-
/**
|
|
3
|
-
* Absolute value of the source number (integer and decimals)
|
|
4
|
-
*/
|
|
5
|
-
Number: number;
|
|
6
|
-
/**
|
|
7
|
-
* Number of digits of `number`
|
|
8
|
-
*/
|
|
9
|
-
IntegerDigits: number;
|
|
10
|
-
/**
|
|
11
|
-
* Number of visible fraction digits in [[Number]], with trailing zeroes.
|
|
12
|
-
*/
|
|
13
|
-
NumberOfFractionDigits: number;
|
|
14
|
-
/**
|
|
15
|
-
* Number of visible fraction digits in [[Number]], without trailing zeroes.
|
|
16
|
-
*/
|
|
17
|
-
NumberOfFractionDigitsWithoutTrailing: number;
|
|
18
|
-
/**
|
|
19
|
-
* Number of visible fractional digits in [[Number]], with trailing zeroes.
|
|
20
|
-
*/
|
|
21
|
-
FractionDigits: number;
|
|
22
|
-
/**
|
|
23
|
-
* Number of visible fractional digits in [[Number]], without trailing zeroes.
|
|
24
|
-
*/
|
|
25
|
-
FractionDigitsWithoutTrailing: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* http://ecma-international.org/ecma-402/7.0/index.html#sec-getoperands
|
|
29
|
-
* @param s
|
|
30
|
-
*/
|
|
31
|
-
export declare function GetOperands(s: string): OperandsRecord;
|
|
32
|
-
//# sourceMappingURL=GetOperands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetOperands.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/PluralRules/GetOperands.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,sBAAsB,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,qCAAqC,EAAE,MAAM,CAAA;IAC7C;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,6BAA6B,EAAE,MAAM,CAAA;CACtC;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAyCrD"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { invariant } from '../utils';
|
|
2
|
-
import { ToNumber } from '../262';
|
|
3
|
-
/**
|
|
4
|
-
* http://ecma-international.org/ecma-402/7.0/index.html#sec-getoperands
|
|
5
|
-
* @param s
|
|
6
|
-
*/
|
|
7
|
-
export function GetOperands(s) {
|
|
8
|
-
invariant(typeof s === 'string', "GetOperands should have been called with a string");
|
|
9
|
-
var n = ToNumber(s);
|
|
10
|
-
invariant(isFinite(n), 'n should be finite');
|
|
11
|
-
var dp = s.indexOf('.');
|
|
12
|
-
var iv;
|
|
13
|
-
var f;
|
|
14
|
-
var v;
|
|
15
|
-
var fv = '';
|
|
16
|
-
if (dp === -1) {
|
|
17
|
-
iv = n;
|
|
18
|
-
f = 0;
|
|
19
|
-
v = 0;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
iv = s.slice(0, dp);
|
|
23
|
-
fv = s.slice(dp, s.length);
|
|
24
|
-
f = ToNumber(fv);
|
|
25
|
-
v = fv.length;
|
|
26
|
-
}
|
|
27
|
-
var i = Math.abs(ToNumber(iv));
|
|
28
|
-
var w;
|
|
29
|
-
var t;
|
|
30
|
-
if (f !== 0) {
|
|
31
|
-
var ft = fv.replace(/0+$/, '');
|
|
32
|
-
w = ft.length;
|
|
33
|
-
t = ToNumber(ft);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
w = 0;
|
|
37
|
-
t = 0;
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
Number: n,
|
|
41
|
-
IntegerDigits: i,
|
|
42
|
-
NumberOfFractionDigits: v,
|
|
43
|
-
NumberOfFractionDigitsWithoutTrailing: w,
|
|
44
|
-
FractionDigits: f,
|
|
45
|
-
FractionDigitsWithoutTrailing: t,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PluralRulesInternal, PluralRulesData } from '../types/plural-rules';
|
|
2
|
-
export declare function InitializePluralRules(pl: Intl.PluralRules, locales: string | string[] | undefined, options: Intl.PluralRulesOptions | undefined, { availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, getInternalSlots, }: {
|
|
3
|
-
availableLocales: Set<string>;
|
|
4
|
-
relevantExtensionKeys: string[];
|
|
5
|
-
localeData: Record<string, PluralRulesData | undefined>;
|
|
6
|
-
getDefaultLocale(): string;
|
|
7
|
-
getInternalSlots(pl: Intl.PluralRules): PluralRulesInternal;
|
|
8
|
-
}): Intl.PluralRules;
|
|
9
|
-
//# sourceMappingURL=InitializePluralRules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InitializePluralRules.d.ts","sourceRoot":"","sources":["../../../../../../../packages/ecma402-abstract/PluralRules/InitializePluralRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAE,eAAe,EAAC,MAAM,uBAAuB,CAAA;AAO1E,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EACtC,OAAO,EAAE,IAAI,CAAC,kBAAkB,GAAG,SAAS,EAC5C,EACE,gBAAgB,EAChB,qBAAqB,EACrB,UAAU,EACV,gBAAgB,EAChB,gBAAgB,GACjB,EAAE;IACD,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC7B,qBAAqB,EAAE,MAAM,EAAE,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC,CAAA;IACvD,gBAAgB,IAAI,MAAM,CAAA;IAC1B,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,WAAW,GAAG,mBAAmB,CAAA;CAC5D,oBAkCF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CanonicalizeLocaleList } from '../CanonicalizeLocaleList';
|
|
2
|
-
import { GetOption } from '../GetOption';
|
|
3
|
-
import { SetNumberFormatDigitOptions } from '../NumberFormat/SetNumberFormatDigitOptions';
|
|
4
|
-
import { ResolveLocale } from '../ResolveLocale';
|
|
5
|
-
import { CoerceOptionsToObject } from '../CoerceOptionsToObject';
|
|
6
|
-
export function InitializePluralRules(pl, locales, options, _a) {
|
|
7
|
-
var availableLocales = _a.availableLocales, relevantExtensionKeys = _a.relevantExtensionKeys, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getInternalSlots = _a.getInternalSlots;
|
|
8
|
-
var requestedLocales = CanonicalizeLocaleList(locales);
|
|
9
|
-
var opt = Object.create(null);
|
|
10
|
-
var opts = CoerceOptionsToObject(options);
|
|
11
|
-
var internalSlots = getInternalSlots(pl);
|
|
12
|
-
internalSlots.initializedPluralRules = true;
|
|
13
|
-
var matcher = GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
14
|
-
opt.localeMatcher = matcher;
|
|
15
|
-
internalSlots.type = GetOption(opts, 'type', 'string', ['cardinal', 'ordinal'], 'cardinal');
|
|
16
|
-
SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, 'standard');
|
|
17
|
-
var r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
18
|
-
internalSlots.locale = r.locale;
|
|
19
|
-
return pl;
|
|
20
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { LDMLPluralRule, PluralRulesInternal } from '../types/plural-rules';
|
|
2
|
-
import { OperandsRecord } from './GetOperands';
|
|
3
|
-
/**
|
|
4
|
-
* http://ecma-international.org/ecma-402/7.0/index.html#sec-resolveplural
|
|
5
|
-
* @param pl
|
|
6
|
-
* @param n
|
|
7
|
-
* @param PluralRuleSelect Has to pass in bc it's implementation-specific
|
|
8
|
-
*/
|
|
9
|
-
export declare function ResolvePlural(pl: Intl.PluralRules, n: number, { getInternalSlots, PluralRuleSelect, }: {
|
|
10
|
-
getInternalSlots(pl: Intl.PluralRules): PluralRulesInternal;
|
|
11
|
-
PluralRuleSelect: (locale: string, type: 'cardinal' | 'ordinal', n: number, operands: OperandsRecord) => LDMLPluralRule;
|
|
12
|
-
}): LDMLPluralRule;
|
|
13
|
-
//# sourceMappingURL=ResolvePlural.d.ts.map
|