@formatjs/intl-pluralrules 4.1.2 → 4.1.6
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/abstract/GetOperands.js +6 -6
- package/abstract/InitializePluralRules.js +6 -6
- package/abstract/ResolvePlural.js +5 -5
- package/index.js +9 -9
- package/lib/index.js +3 -3
- package/package.json +3 -3
- package/polyfill.iife.js +53 -53
- package/polyfill.js +1 -1
package/abstract/GetOperands.js
CHANGED
|
@@ -7,9 +7,9 @@ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
|
7
7
|
* @param s
|
|
8
8
|
*/
|
|
9
9
|
function GetOperands(s) {
|
|
10
|
-
ecma402_abstract_1.invariant(typeof s === 'string', "GetOperands should have been called with a string");
|
|
11
|
-
var n = ecma402_abstract_1.ToNumber(s);
|
|
12
|
-
ecma402_abstract_1.invariant(isFinite(n), 'n should be finite');
|
|
10
|
+
(0, ecma402_abstract_1.invariant)(typeof s === 'string', "GetOperands should have been called with a string");
|
|
11
|
+
var n = (0, ecma402_abstract_1.ToNumber)(s);
|
|
12
|
+
(0, ecma402_abstract_1.invariant)(isFinite(n), 'n should be finite');
|
|
13
13
|
var dp = s.indexOf('.');
|
|
14
14
|
var iv;
|
|
15
15
|
var f;
|
|
@@ -23,16 +23,16 @@ function GetOperands(s) {
|
|
|
23
23
|
else {
|
|
24
24
|
iv = s.slice(0, dp);
|
|
25
25
|
fv = s.slice(dp, s.length);
|
|
26
|
-
f = ecma402_abstract_1.ToNumber(fv);
|
|
26
|
+
f = (0, ecma402_abstract_1.ToNumber)(fv);
|
|
27
27
|
v = fv.length;
|
|
28
28
|
}
|
|
29
|
-
var i = Math.abs(ecma402_abstract_1.ToNumber(iv));
|
|
29
|
+
var i = Math.abs((0, ecma402_abstract_1.ToNumber)(iv));
|
|
30
30
|
var w;
|
|
31
31
|
var t;
|
|
32
32
|
if (f !== 0) {
|
|
33
33
|
var ft = fv.replace(/0+$/, '');
|
|
34
34
|
w = ft.length;
|
|
35
|
-
t = ecma402_abstract_1.ToNumber(ft);
|
|
35
|
+
t = (0, ecma402_abstract_1.ToNumber)(ft);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
w = 0;
|
|
@@ -5,16 +5,16 @@ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
|
5
5
|
var intl_localematcher_1 = require("@formatjs/intl-localematcher");
|
|
6
6
|
function InitializePluralRules(pl, locales, options, _a) {
|
|
7
7
|
var availableLocales = _a.availableLocales, relevantExtensionKeys = _a.relevantExtensionKeys, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getInternalSlots = _a.getInternalSlots;
|
|
8
|
-
var requestedLocales = ecma402_abstract_1.CanonicalizeLocaleList(locales);
|
|
8
|
+
var requestedLocales = (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales);
|
|
9
9
|
var opt = Object.create(null);
|
|
10
|
-
var opts = ecma402_abstract_1.CoerceOptionsToObject(options);
|
|
10
|
+
var opts = (0, ecma402_abstract_1.CoerceOptionsToObject)(options);
|
|
11
11
|
var internalSlots = getInternalSlots(pl);
|
|
12
12
|
internalSlots.initializedPluralRules = true;
|
|
13
|
-
var matcher = ecma402_abstract_1.GetOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
13
|
+
var matcher = (0, ecma402_abstract_1.GetOption)(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit');
|
|
14
14
|
opt.localeMatcher = matcher;
|
|
15
|
-
internalSlots.type = ecma402_abstract_1.GetOption(opts, 'type', 'string', ['cardinal', 'ordinal'], 'cardinal');
|
|
16
|
-
ecma402_abstract_1.SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, 'standard');
|
|
17
|
-
var r = intl_localematcher_1.ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
15
|
+
internalSlots.type = (0, ecma402_abstract_1.GetOption)(opts, 'type', 'string', ['cardinal', 'ordinal'], 'cardinal');
|
|
16
|
+
(0, ecma402_abstract_1.SetNumberFormatDigitOptions)(internalSlots, opts, 0, 3, 'standard');
|
|
17
|
+
var r = (0, intl_localematcher_1.ResolveLocale)(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);
|
|
18
18
|
internalSlots.locale = r.locale;
|
|
19
19
|
return pl;
|
|
20
20
|
}
|
|
@@ -12,16 +12,16 @@ var GetOperands_1 = require("./GetOperands");
|
|
|
12
12
|
function ResolvePlural(pl, n, _a) {
|
|
13
13
|
var getInternalSlots = _a.getInternalSlots, PluralRuleSelect = _a.PluralRuleSelect;
|
|
14
14
|
var internalSlots = getInternalSlots(pl);
|
|
15
|
-
ecma402_abstract_1.invariant(ecma402_abstract_1.Type(internalSlots) === 'Object', 'pl has to be an object');
|
|
16
|
-
ecma402_abstract_1.invariant('initializedPluralRules' in internalSlots, 'pluralrules must be initialized');
|
|
17
|
-
ecma402_abstract_1.invariant(ecma402_abstract_1.Type(n) === 'Number', 'n must be a number');
|
|
15
|
+
(0, ecma402_abstract_1.invariant)((0, ecma402_abstract_1.Type)(internalSlots) === 'Object', 'pl has to be an object');
|
|
16
|
+
(0, ecma402_abstract_1.invariant)('initializedPluralRules' in internalSlots, 'pluralrules must be initialized');
|
|
17
|
+
(0, ecma402_abstract_1.invariant)((0, ecma402_abstract_1.Type)(n) === 'Number', 'n must be a number');
|
|
18
18
|
if (!isFinite(n)) {
|
|
19
19
|
return 'other';
|
|
20
20
|
}
|
|
21
21
|
var locale = internalSlots.locale, type = internalSlots.type;
|
|
22
|
-
var res = ecma402_abstract_1.FormatNumericToString(internalSlots, n);
|
|
22
|
+
var res = (0, ecma402_abstract_1.FormatNumericToString)(internalSlots, n);
|
|
23
23
|
var s = res.formattedString;
|
|
24
|
-
var operands = GetOperands_1.GetOperands(s);
|
|
24
|
+
var operands = (0, GetOperands_1.GetOperands)(s);
|
|
25
25
|
return PluralRuleSelect(locale, type, n, operands);
|
|
26
26
|
}
|
|
27
27
|
exports.ResolvePlural = ResolvePlural;
|
package/index.js
CHANGED
|
@@ -5,10 +5,10 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
6
6
|
var InitializePluralRules_1 = require("./abstract/InitializePluralRules");
|
|
7
7
|
var ResolvePlural_1 = require("./abstract/ResolvePlural");
|
|
8
|
-
var get_internal_slots_1 = tslib_1.__importDefault(require("./get_internal_slots"));
|
|
8
|
+
var get_internal_slots_1 = (0, tslib_1.__importDefault)(require("./get_internal_slots"));
|
|
9
9
|
function validateInstance(instance, method) {
|
|
10
10
|
if (!(instance instanceof PluralRules)) {
|
|
11
|
-
throw new TypeError("Method Intl.PluralRules.prototype."
|
|
11
|
+
throw new TypeError("Method Intl.PluralRules.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -21,7 +21,7 @@ function validateInstance(instance, method) {
|
|
|
21
21
|
function PluralRuleSelect(locale, type, _n, _a) {
|
|
22
22
|
var IntegerDigits = _a.IntegerDigits, NumberOfFractionDigits = _a.NumberOfFractionDigits, FractionDigits = _a.FractionDigits;
|
|
23
23
|
return PluralRules.localeData[locale].fn(NumberOfFractionDigits
|
|
24
|
-
? IntegerDigits
|
|
24
|
+
? "".concat(IntegerDigits, ".").concat(FractionDigits)
|
|
25
25
|
: IntegerDigits, type === 'ordinal');
|
|
26
26
|
}
|
|
27
27
|
var PluralRules = /** @class */ (function () {
|
|
@@ -32,7 +32,7 @@ var PluralRules = /** @class */ (function () {
|
|
|
32
32
|
if (!newTarget) {
|
|
33
33
|
throw new TypeError("Intl.PluralRules must be called with 'new'");
|
|
34
34
|
}
|
|
35
|
-
return InitializePluralRules_1.InitializePluralRules(this, locales, options, {
|
|
35
|
+
return (0, InitializePluralRules_1.InitializePluralRules)(this, locales, options, {
|
|
36
36
|
availableLocales: PluralRules.availableLocales,
|
|
37
37
|
relevantExtensionKeys: PluralRules.relevantExtensionKeys,
|
|
38
38
|
localeData: PluralRules.localeData,
|
|
@@ -43,7 +43,7 @@ var PluralRules = /** @class */ (function () {
|
|
|
43
43
|
PluralRules.prototype.resolvedOptions = function () {
|
|
44
44
|
validateInstance(this, 'resolvedOptions');
|
|
45
45
|
var opts = Object.create(null);
|
|
46
|
-
var internalSlots = get_internal_slots_1.default(this);
|
|
46
|
+
var internalSlots = (0, get_internal_slots_1.default)(this);
|
|
47
47
|
opts.locale = internalSlots.locale;
|
|
48
48
|
opts.type = internalSlots.type;
|
|
49
49
|
[
|
|
@@ -58,20 +58,20 @@ var PluralRules = /** @class */ (function () {
|
|
|
58
58
|
opts[field] = val;
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
opts.pluralCategories = tslib_1.__spreadArray([], PluralRules.localeData[opts.locale].categories[opts.type]);
|
|
61
|
+
opts.pluralCategories = (0, tslib_1.__spreadArray)([], PluralRules.localeData[opts.locale].categories[opts.type], true);
|
|
62
62
|
return opts;
|
|
63
63
|
};
|
|
64
64
|
PluralRules.prototype.select = function (val) {
|
|
65
65
|
var pr = this;
|
|
66
66
|
validateInstance(pr, 'select');
|
|
67
|
-
var n = ecma402_abstract_1.ToNumber(val);
|
|
68
|
-
return ResolvePlural_1.ResolvePlural(pr, n, { getInternalSlots: get_internal_slots_1.default, PluralRuleSelect: PluralRuleSelect });
|
|
67
|
+
var n = (0, ecma402_abstract_1.ToNumber)(val);
|
|
68
|
+
return (0, ResolvePlural_1.ResolvePlural)(pr, n, { getInternalSlots: get_internal_slots_1.default, PluralRuleSelect: PluralRuleSelect });
|
|
69
69
|
};
|
|
70
70
|
PluralRules.prototype.toString = function () {
|
|
71
71
|
return '[object Intl.PluralRules]';
|
|
72
72
|
};
|
|
73
73
|
PluralRules.supportedLocalesOf = function (locales, options) {
|
|
74
|
-
return ecma402_abstract_1.SupportedLocales(PluralRules.availableLocales, ecma402_abstract_1.CanonicalizeLocaleList(locales), options);
|
|
74
|
+
return (0, ecma402_abstract_1.SupportedLocales)(PluralRules.availableLocales, (0, ecma402_abstract_1.CanonicalizeLocaleList)(locales), options);
|
|
75
75
|
};
|
|
76
76
|
PluralRules.__addLocaleData = function () {
|
|
77
77
|
var data = [];
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ResolvePlural } from './abstract/ResolvePlural';
|
|
|
5
5
|
import getInternalSlots from './get_internal_slots';
|
|
6
6
|
function validateInstance(instance, method) {
|
|
7
7
|
if (!(instance instanceof PluralRules)) {
|
|
8
|
-
throw new TypeError("Method Intl.PluralRules.prototype."
|
|
8
|
+
throw new TypeError("Method Intl.PluralRules.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
@@ -18,7 +18,7 @@ function validateInstance(instance, method) {
|
|
|
18
18
|
function PluralRuleSelect(locale, type, _n, _a) {
|
|
19
19
|
var IntegerDigits = _a.IntegerDigits, NumberOfFractionDigits = _a.NumberOfFractionDigits, FractionDigits = _a.FractionDigits;
|
|
20
20
|
return PluralRules.localeData[locale].fn(NumberOfFractionDigits
|
|
21
|
-
? IntegerDigits
|
|
21
|
+
? "".concat(IntegerDigits, ".").concat(FractionDigits)
|
|
22
22
|
: IntegerDigits, type === 'ordinal');
|
|
23
23
|
}
|
|
24
24
|
var PluralRules = /** @class */ (function () {
|
|
@@ -55,7 +55,7 @@ var PluralRules = /** @class */ (function () {
|
|
|
55
55
|
opts[field] = val;
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
opts.pluralCategories = __spreadArray([], PluralRules.localeData[opts.locale].categories[opts.type]);
|
|
58
|
+
opts.pluralCategories = __spreadArray([], PluralRules.localeData[opts.locale].categories[opts.type], true);
|
|
59
59
|
return opts;
|
|
60
60
|
};
|
|
61
61
|
PluralRules.prototype.select = function (val) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/intl-pluralrules",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.6",
|
|
4
4
|
"description": "Polyfill for Intl.PluralRules",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"polyfill",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"url": "git+https://github.com/formatjs/formatjs.git"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@formatjs/ecma402-abstract": "1.
|
|
24
|
-
"@formatjs/intl-localematcher": "0.2.
|
|
23
|
+
"@formatjs/ecma402-abstract": "1.11.0",
|
|
24
|
+
"@formatjs/intl-localematcher": "0.2.21",
|
|
25
25
|
"tslib": "^2.1.0"
|
|
26
26
|
},
|
|
27
27
|
"bugs": {
|
package/polyfill.iife.js
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __markAsModule = function(target) {
|
|
9
|
-
return __defProp(target, "__esModule", {value: true});
|
|
9
|
+
return __defProp(target, "__esModule", { value: true });
|
|
10
10
|
};
|
|
11
11
|
var __commonJS = function(cb, mod) {
|
|
12
12
|
return function __require() {
|
|
13
|
-
return mod || (0, cb[Object.keys(cb)[0]])((mod = {exports: {}}).exports, mod), mod.exports;
|
|
13
|
+
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
var __reExport = function(target, module, desc) {
|
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
for (var keys = __getOwnPropNames(module), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
19
|
key = keys[i];
|
|
20
20
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
21
|
-
__defProp(target, key, {get: function(k) {
|
|
21
|
+
__defProp(target, key, { get: function(k) {
|
|
22
22
|
return module[k];
|
|
23
|
-
}.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable});
|
|
23
|
+
}.bind(null, key), enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
|
|
24
24
|
}
|
|
25
25
|
return target;
|
|
26
26
|
};
|
|
27
27
|
var __toModule = function(module) {
|
|
28
|
-
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? {get: function() {
|
|
28
|
+
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", module && module.__esModule && "default" in module ? { get: function() {
|
|
29
29
|
return module.default;
|
|
30
|
-
}, enumerable: true} : {value: module, enumerable: true})), module);
|
|
30
|
+
}, enumerable: true } : { value: module, enumerable: true })), module);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js
|
|
34
34
|
var require_utils = __commonJS({
|
|
35
35
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/utils.js": function(exports) {
|
|
36
36
|
"use strict";
|
|
37
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.invariant = exports.UNICODE_EXTENSION_SEQUENCE_REGEX = void 0;
|
|
39
39
|
exports.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;
|
|
40
40
|
function invariant2(condition, message, Err) {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
var require_BestAvailableLocale = __commonJS({
|
|
54
54
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestAvailableLocale.js": function(exports) {
|
|
55
55
|
"use strict";
|
|
56
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
57
|
exports.BestAvailableLocale = void 0;
|
|
58
58
|
function BestAvailableLocale(availableLocales, locale) {
|
|
59
59
|
var candidate = locale;
|
|
@@ -79,16 +79,16 @@
|
|
|
79
79
|
var require_LookupMatcher = __commonJS({
|
|
80
80
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupMatcher.js": function(exports) {
|
|
81
81
|
"use strict";
|
|
82
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
82
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
83
83
|
exports.LookupMatcher = void 0;
|
|
84
84
|
var utils_1 = require_utils();
|
|
85
85
|
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
86
86
|
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
|
|
87
|
-
var result = {locale: ""};
|
|
87
|
+
var result = { locale: "" };
|
|
88
88
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
89
89
|
var locale = requestedLocales_1[_i];
|
|
90
90
|
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
91
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
91
|
+
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
|
|
92
92
|
if (availableLocale) {
|
|
93
93
|
result.locale = availableLocale;
|
|
94
94
|
if (locale !== noExtensionLocale) {
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
var require_BestFitMatcher = __commonJS({
|
|
109
109
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/BestFitMatcher.js": function(exports) {
|
|
110
110
|
"use strict";
|
|
111
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
111
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
112
112
|
exports.BestFitMatcher = void 0;
|
|
113
113
|
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
114
114
|
var utils_1 = require_utils();
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
foundLocale = minimizedRequestedLocale;
|
|
146
146
|
break;
|
|
147
147
|
}
|
|
148
|
-
foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
148
|
+
foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
149
149
|
}
|
|
150
150
|
return {
|
|
151
151
|
locale: foundLocale && minimizedAvailableLocaleMap[foundLocale] || getDefaultLocale()
|
|
@@ -159,13 +159,13 @@
|
|
|
159
159
|
var require_UnicodeExtensionValue = __commonJS({
|
|
160
160
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/UnicodeExtensionValue.js": function(exports) {
|
|
161
161
|
"use strict";
|
|
162
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
162
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
163
163
|
exports.UnicodeExtensionValue = void 0;
|
|
164
164
|
var utils_1 = require_utils();
|
|
165
165
|
function UnicodeExtensionValue(extension, key) {
|
|
166
|
-
utils_1.invariant(key.length === 2, "key must have 2 elements");
|
|
166
|
+
(0, utils_1.invariant)(key.length === 2, "key must have 2 elements");
|
|
167
167
|
var size = extension.length;
|
|
168
|
-
var searchValue = "-"
|
|
168
|
+
var searchValue = "-".concat(key, "-");
|
|
169
169
|
var pos = extension.indexOf(searchValue);
|
|
170
170
|
if (pos !== -1) {
|
|
171
171
|
var start = pos + 4;
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
}
|
|
193
193
|
return extension.slice(start, end);
|
|
194
194
|
}
|
|
195
|
-
searchValue = "-"
|
|
195
|
+
searchValue = "-".concat(key);
|
|
196
196
|
pos = extension.indexOf(searchValue);
|
|
197
197
|
if (pos !== -1 && pos + 3 === size) {
|
|
198
198
|
return "";
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
var require_ResolveLocale = __commonJS({
|
|
208
208
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/ResolveLocale.js": function(exports) {
|
|
209
209
|
"use strict";
|
|
210
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
210
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
211
211
|
exports.ResolveLocale = void 0;
|
|
212
212
|
var LookupMatcher_1 = require_LookupMatcher();
|
|
213
213
|
var BestFitMatcher_1 = require_BestFitMatcher();
|
|
@@ -217,40 +217,40 @@
|
|
|
217
217
|
var matcher = options.localeMatcher;
|
|
218
218
|
var r;
|
|
219
219
|
if (matcher === "lookup") {
|
|
220
|
-
r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
220
|
+
r = (0, LookupMatcher_1.LookupMatcher)(availableLocales, requestedLocales, getDefaultLocale);
|
|
221
221
|
} else {
|
|
222
|
-
r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
222
|
+
r = (0, BestFitMatcher_1.BestFitMatcher)(availableLocales, requestedLocales, getDefaultLocale);
|
|
223
223
|
}
|
|
224
224
|
var foundLocale = r.locale;
|
|
225
|
-
var result = {locale: "", dataLocale: foundLocale};
|
|
225
|
+
var result = { locale: "", dataLocale: foundLocale };
|
|
226
226
|
var supportedExtension = "-u";
|
|
227
227
|
for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
|
|
228
228
|
var key = relevantExtensionKeys_1[_i];
|
|
229
|
-
utils_1.invariant(foundLocale in localeData, "Missing locale data for "
|
|
229
|
+
(0, utils_1.invariant)(foundLocale in localeData, "Missing locale data for ".concat(foundLocale));
|
|
230
230
|
var foundLocaleData = localeData[foundLocale];
|
|
231
|
-
utils_1.invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data "
|
|
231
|
+
(0, utils_1.invariant)(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data ".concat(key, " must be an object"));
|
|
232
232
|
var keyLocaleData = foundLocaleData[key];
|
|
233
|
-
utils_1.invariant(Array.isArray(keyLocaleData), "keyLocaleData for "
|
|
233
|
+
(0, utils_1.invariant)(Array.isArray(keyLocaleData), "keyLocaleData for ".concat(key, " must be an array"));
|
|
234
234
|
var value = keyLocaleData[0];
|
|
235
|
-
utils_1.invariant(typeof value === "string" || value === null, "value must be string or null but got "
|
|
235
|
+
(0, utils_1.invariant)(typeof value === "string" || value === null, "value must be string or null but got ".concat(typeof value, " in key ").concat(key));
|
|
236
236
|
var supportedExtensionAddition = "";
|
|
237
237
|
if (r.extension) {
|
|
238
|
-
var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);
|
|
238
|
+
var requestedValue = (0, UnicodeExtensionValue_1.UnicodeExtensionValue)(r.extension, key);
|
|
239
239
|
if (requestedValue !== void 0) {
|
|
240
240
|
if (requestedValue !== "") {
|
|
241
241
|
if (~keyLocaleData.indexOf(requestedValue)) {
|
|
242
242
|
value = requestedValue;
|
|
243
|
-
supportedExtensionAddition = "-"
|
|
243
|
+
supportedExtensionAddition = "-".concat(key, "-").concat(value);
|
|
244
244
|
}
|
|
245
245
|
} else if (~requestedValue.indexOf("true")) {
|
|
246
246
|
value = "true";
|
|
247
|
-
supportedExtensionAddition = "-"
|
|
247
|
+
supportedExtensionAddition = "-".concat(key);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
if (key in options) {
|
|
252
252
|
var optionsValue = options[key];
|
|
253
|
-
utils_1.invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
253
|
+
(0, utils_1.invariant)(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
254
254
|
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
255
255
|
if (optionsValue !== value) {
|
|
256
256
|
value = optionsValue;
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
var require_LookupSupportedLocales = __commonJS({
|
|
284
284
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/abstract/LookupSupportedLocales.js": function(exports) {
|
|
285
285
|
"use strict";
|
|
286
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
286
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
287
287
|
exports.LookupSupportedLocales = void 0;
|
|
288
288
|
var utils_1 = require_utils();
|
|
289
289
|
var BestAvailableLocale_1 = require_BestAvailableLocale();
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
293
293
|
var locale = requestedLocales_1[_i];
|
|
294
294
|
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
295
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
295
|
+
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
|
|
296
296
|
if (availableLocale) {
|
|
297
297
|
subset.push(availableLocale);
|
|
298
298
|
}
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
var require_intl_localematcher = __commonJS({
|
|
308
308
|
"bazel-out/darwin-fastbuild/bin/packages/intl-localematcher/index.js": function(exports) {
|
|
309
309
|
"use strict";
|
|
310
|
-
Object.defineProperty(exports, "__esModule", {value: true});
|
|
310
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
311
311
|
exports.ResolveLocale = exports.LookupSupportedLocales = exports.match = void 0;
|
|
312
312
|
var ResolveLocale_1 = require_ResolveLocale();
|
|
313
313
|
function match(requestedLocales, availableLocales, defaultLocale, opts) {
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
all.add(l);
|
|
316
316
|
return all;
|
|
317
317
|
}, new Set());
|
|
318
|
-
return ResolveLocale_1.ResolveLocale(locales, requestedLocales, {
|
|
318
|
+
return (0, ResolveLocale_1.ResolveLocale)(locales, requestedLocales, {
|
|
319
319
|
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
320
320
|
}, [], {}, function() {
|
|
321
321
|
return defaultLocale;
|
|
@@ -323,19 +323,19 @@
|
|
|
323
323
|
}
|
|
324
324
|
exports.match = match;
|
|
325
325
|
var LookupSupportedLocales_1 = require_LookupSupportedLocales();
|
|
326
|
-
Object.defineProperty(exports, "LookupSupportedLocales", {enumerable: true, get: function() {
|
|
326
|
+
Object.defineProperty(exports, "LookupSupportedLocales", { enumerable: true, get: function() {
|
|
327
327
|
return LookupSupportedLocales_1.LookupSupportedLocales;
|
|
328
|
-
}});
|
|
328
|
+
} });
|
|
329
329
|
var ResolveLocale_2 = require_ResolveLocale();
|
|
330
|
-
Object.defineProperty(exports, "ResolveLocale", {enumerable: true, get: function() {
|
|
330
|
+
Object.defineProperty(exports, "ResolveLocale", { enumerable: true, get: function() {
|
|
331
331
|
return ResolveLocale_2.ResolveLocale;
|
|
332
|
-
}});
|
|
332
|
+
} });
|
|
333
333
|
}
|
|
334
334
|
});
|
|
335
335
|
|
|
336
336
|
// node_modules/tslib/tslib.es6.js
|
|
337
337
|
var extendStatics = function(d, b) {
|
|
338
|
-
extendStatics = Object.setPrototypeOf || {__proto__: []} instanceof Array && function(d2, b2) {
|
|
338
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
339
339
|
d2.__proto__ = b2;
|
|
340
340
|
} || function(d2, b2) {
|
|
341
341
|
for (var p in b2)
|
|
@@ -455,7 +455,7 @@
|
|
|
455
455
|
if (val !== void 0) {
|
|
456
456
|
val = Number(val);
|
|
457
457
|
if (isNaN(val) || val < min || val > max) {
|
|
458
|
-
throw new RangeError(val
|
|
458
|
+
throw new RangeError("".concat(val, " is outside of range [").concat(min, ", ").concat(max, "]"));
|
|
459
459
|
}
|
|
460
460
|
return Math.floor(val);
|
|
461
461
|
}
|
|
@@ -487,7 +487,7 @@
|
|
|
487
487
|
if (values !== void 0 && !values.filter(function(val) {
|
|
488
488
|
return val == value;
|
|
489
489
|
}).length) {
|
|
490
|
-
throw new RangeError(value
|
|
490
|
+
throw new RangeError("".concat(value, " is not within ").concat(values.join(", ")));
|
|
491
491
|
}
|
|
492
492
|
return value;
|
|
493
493
|
}
|
|
@@ -604,10 +604,10 @@
|
|
|
604
604
|
m = m + repeat("0", e - p + 1);
|
|
605
605
|
int = e + 1;
|
|
606
606
|
} else if (e >= 0) {
|
|
607
|
-
m = m.slice(0, e + 1)
|
|
607
|
+
m = "".concat(m.slice(0, e + 1), ".").concat(m.slice(e + 1));
|
|
608
608
|
int = e + 1;
|
|
609
609
|
} else {
|
|
610
|
-
m = "0."
|
|
610
|
+
m = "0.".concat(repeat("0", -e - 1)).concat(m);
|
|
611
611
|
int = 1;
|
|
612
612
|
}
|
|
613
613
|
if (m.indexOf(".") >= 0 && maxPrecision > minPrecision) {
|
|
@@ -620,7 +620,7 @@
|
|
|
620
620
|
m = m.slice(0, -1);
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
|
-
return {formattedString: m, roundedNumber: xFinal, integerDigitsCount: int};
|
|
623
|
+
return { formattedString: m, roundedNumber: xFinal, integerDigitsCount: int };
|
|
624
624
|
function adjustDecimalPlace(x2, magnitude) {
|
|
625
625
|
return magnitude < 0 ? x2 * Math.pow(10, -magnitude) : x2 / Math.pow(10, magnitude);
|
|
626
626
|
}
|
|
@@ -650,7 +650,7 @@
|
|
|
650
650
|
}
|
|
651
651
|
var a = m.slice(0, k - f);
|
|
652
652
|
var b = m.slice(k - f);
|
|
653
|
-
m = a
|
|
653
|
+
m = "".concat(a, ".").concat(b);
|
|
654
654
|
int = a.length;
|
|
655
655
|
} else {
|
|
656
656
|
int = m.length;
|
|
@@ -663,7 +663,7 @@
|
|
|
663
663
|
if (m[m.length - 1] === ".") {
|
|
664
664
|
m = m.slice(0, -1);
|
|
665
665
|
}
|
|
666
|
-
return {formattedString: m, roundedNumber: xFinal, integerDigitsCount: int};
|
|
666
|
+
return { formattedString: m, roundedNumber: xFinal, integerDigitsCount: int };
|
|
667
667
|
}
|
|
668
668
|
|
|
669
669
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/FormatNumericToString.js
|
|
@@ -699,15 +699,15 @@
|
|
|
699
699
|
if (isNegative) {
|
|
700
700
|
x = -x;
|
|
701
701
|
}
|
|
702
|
-
return {roundedNumber: x, formattedString: string};
|
|
702
|
+
return { roundedNumber: x, formattedString: string };
|
|
703
703
|
}
|
|
704
704
|
|
|
705
705
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/regex.generated.js
|
|
706
706
|
var S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BF\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;
|
|
707
707
|
|
|
708
708
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/format_to_parts.js
|
|
709
|
-
var CARET_S_UNICODE_REGEX = new RegExp("^"
|
|
710
|
-
var S_DOLLAR_UNICODE_REGEX = new RegExp(S_UNICODE_REGEX.source
|
|
709
|
+
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
|
|
710
|
+
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
|
|
711
711
|
|
|
712
712
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/InitializeNumberFormat.js
|
|
713
713
|
var import_intl_localematcher = __toModule(require_intl_localematcher());
|
|
@@ -865,12 +865,12 @@
|
|
|
865
865
|
// bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/index.js
|
|
866
866
|
function validateInstance(instance, method) {
|
|
867
867
|
if (!(instance instanceof PluralRules)) {
|
|
868
|
-
throw new TypeError("Method Intl.PluralRules.prototype."
|
|
868
|
+
throw new TypeError("Method Intl.PluralRules.prototype.".concat(method, " called on incompatible receiver ").concat(String(instance)));
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
871
|
function PluralRuleSelect(locale, type, _n, _a) {
|
|
872
872
|
var IntegerDigits = _a.IntegerDigits, NumberOfFractionDigits = _a.NumberOfFractionDigits, FractionDigits = _a.FractionDigits;
|
|
873
|
-
return PluralRules.localeData[locale].fn(NumberOfFractionDigits ? IntegerDigits
|
|
873
|
+
return PluralRules.localeData[locale].fn(NumberOfFractionDigits ? "".concat(IntegerDigits, ".").concat(FractionDigits) : IntegerDigits, type === "ordinal");
|
|
874
874
|
}
|
|
875
875
|
var PluralRules = function() {
|
|
876
876
|
function PluralRules2(locales, options) {
|
|
@@ -904,14 +904,14 @@
|
|
|
904
904
|
opts[field] = val;
|
|
905
905
|
}
|
|
906
906
|
});
|
|
907
|
-
opts.pluralCategories = __spreadArray([], PluralRules2.localeData[opts.locale].categories[opts.type]);
|
|
907
|
+
opts.pluralCategories = __spreadArray([], PluralRules2.localeData[opts.locale].categories[opts.type], true);
|
|
908
908
|
return opts;
|
|
909
909
|
};
|
|
910
910
|
PluralRules2.prototype.select = function(val) {
|
|
911
911
|
var pr = this;
|
|
912
912
|
validateInstance(pr, "select");
|
|
913
913
|
var n = ToNumber(val);
|
|
914
|
-
return ResolvePlural(pr, n, {getInternalSlots: getInternalSlots, PluralRuleSelect: PluralRuleSelect});
|
|
914
|
+
return ResolvePlural(pr, n, { getInternalSlots: getInternalSlots, PluralRuleSelect: PluralRuleSelect });
|
|
915
915
|
};
|
|
916
916
|
PluralRules2.prototype.toString = function() {
|
|
917
917
|
return "[object Intl.PluralRules]";
|
|
@@ -985,7 +985,7 @@
|
|
|
985
985
|
return Intl.PluralRules.supportedLocalesOf(locales).length === locales.length;
|
|
986
986
|
}
|
|
987
987
|
function shouldPolyfill(locale) {
|
|
988
|
-
return !("PluralRules" in Intl) || new Intl.PluralRules("en", {minimumFractionDigits: 2}).select(1) === "one" || !supportedLocalesOf(locale);
|
|
988
|
+
return !("PluralRules" in Intl) || new Intl.PluralRules("en", { minimumFractionDigits: 2 }).select(1) === "one" || !supportedLocalesOf(locale);
|
|
989
989
|
}
|
|
990
990
|
|
|
991
991
|
// bazel-out/darwin-fastbuild/bin/packages/intl-pluralrules/lib/polyfill.js
|
package/polyfill.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var _1 = require("./");
|
|
4
4
|
var should_polyfill_1 = require("./should-polyfill");
|
|
5
|
-
if (should_polyfill_1.shouldPolyfill()) {
|
|
5
|
+
if ((0, should_polyfill_1.shouldPolyfill)()) {
|
|
6
6
|
Object.defineProperty(Intl, 'PluralRules', {
|
|
7
7
|
value: _1.PluralRules,
|
|
8
8
|
writable: true,
|