intl-pluralrules
Advanced tools
Comparing version 2.0.0-0 to 2.0.0-1
231
factory.js
@@ -6,13 +6,7 @@ 'use strict'; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}, _typeof(obj); | ||
} | ||
@@ -39,12 +33,62 @@ | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
Object.defineProperty(Constructor, "prototype", { | ||
writable: false | ||
}); | ||
return Constructor; | ||
} | ||
// does not check for duplicate subtags | ||
var isStructurallyValidLanguageTag = function isStructurallyValidLanguageTag(locale) { | ||
return locale.split('-').every(function (subtag) { | ||
return /[a-z0-9]+/i.test(subtag); | ||
}); | ||
}; | ||
function _classPrivateFieldGet(receiver, privateMap) { | ||
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); | ||
return _classApplyDescriptorGet(receiver, descriptor); | ||
} | ||
function _classPrivateFieldSet(receiver, privateMap, value) { | ||
var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); | ||
_classApplyDescriptorSet(receiver, descriptor, value); | ||
return value; | ||
} | ||
function _classExtractFieldDescriptor(receiver, privateMap, action) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to " + action + " private field on non-instance"); | ||
} | ||
return privateMap.get(receiver); | ||
} | ||
function _classApplyDescriptorGet(receiver, descriptor) { | ||
if (descriptor.get) { | ||
return descriptor.get.call(receiver); | ||
} | ||
return descriptor.value; | ||
} | ||
function _classApplyDescriptorSet(receiver, descriptor, value) { | ||
if (descriptor.set) { | ||
descriptor.set.call(receiver, value); | ||
} else { | ||
if (!descriptor.writable) { | ||
throw new TypeError("attempted to set read only private field"); | ||
} | ||
descriptor.value = value; | ||
} | ||
} | ||
function _checkPrivateRedeclaration(obj, privateCollection) { | ||
if (privateCollection.has(obj)) { | ||
throw new TypeError("Cannot initialize the same private elements twice on an object"); | ||
} | ||
} | ||
function _classPrivateFieldInitSpec(obj, privateMap, value) { | ||
_checkPrivateRedeclaration(obj, privateMap); | ||
privateMap.set(obj, value); | ||
} | ||
var canonicalizeLocaleList = function canonicalizeLocaleList(locales) { | ||
@@ -56,2 +100,4 @@ if (!locales) return []; | ||
for (var i = 0; i < locales.length; ++i) { | ||
var _in$iw$ji$lc; | ||
var tag = locales[i]; | ||
@@ -68,5 +114,7 @@ if (tag && _typeof(tag) === 'object') tag = String(tag); | ||
if (tag[0] === '*') continue; | ||
var parts = tag.split('-'); // does not check for duplicate subtags | ||
if (!isStructurallyValidLanguageTag(tag)) { | ||
if (!parts.every(function (subtag) { | ||
return /[a-z0-9]+/i.test(subtag); | ||
})) { | ||
var strTag = JSON.stringify(tag); | ||
@@ -77,5 +125,13 @@ | ||
throw new RangeError(_msg); | ||
} | ||
} // always use lower case for primary language subtag | ||
res[tag] = true; | ||
var lc = parts[0].toLowerCase(); // replace deprecated codes for Indonesian, Hebrew & Yiddish | ||
parts[0] = (_in$iw$ji$lc = { | ||
in: 'id', | ||
iw: 'he', | ||
ji: 'yi' | ||
}[lc]) !== null && _in$iw$ji$lc !== void 0 ? _in$iw$ji$lc : lc; | ||
res[parts.join('-')] = true; | ||
} | ||
@@ -86,15 +142,22 @@ | ||
var defaultLocale = function defaultLocale() { | ||
return ( | ||
/* istanbul ignore next */ | ||
typeof navigator !== 'undefined' && navigator && (navigator.userLanguage || navigator.language) || 'en-US' | ||
); | ||
}; | ||
var getType = function getType(type) { | ||
function getType(opt) { | ||
var type = Object.prototype.hasOwnProperty.call(opt, 'type') && opt.type; | ||
if (!type) return 'cardinal'; | ||
if (type === 'cardinal' || type === 'ordinal') return type; | ||
throw new RangeError('Not a valid plural type: ' + JSON.stringify(type)); | ||
}; | ||
} | ||
function toNumber(value) { | ||
switch (_typeof(value)) { | ||
case 'number': | ||
return value; | ||
case 'bigint': | ||
throw new TypeError('Cannot convert a BigInt value to a number'); | ||
default: | ||
return Number(value); | ||
} | ||
} | ||
function getPluralRules(NumberFormat, getSelector, getCategories, getRangeSelector) { | ||
@@ -114,11 +177,24 @@ var findLocale = function findLocale(locale) { | ||
for (var i = 0; i < canonicalLocales.length; ++i) { | ||
var lc = findLocale(canonicalLocales[i]); | ||
if (lc) return lc; | ||
var _lc = findLocale(canonicalLocales[i]); | ||
if (_lc) return _lc; | ||
} | ||
return findLocale(defaultLocale()); | ||
var lc = new NumberFormat().resolvedOptions().locale; | ||
return findLocale(lc); | ||
}; | ||
var _locale = /*#__PURE__*/new WeakMap(); | ||
var _range = /*#__PURE__*/new WeakMap(); | ||
var _select = /*#__PURE__*/new WeakMap(); | ||
var _type = /*#__PURE__*/new WeakMap(); | ||
var _nf = /*#__PURE__*/new WeakMap(); | ||
var PluralRules = /*#__PURE__*/function () { | ||
function PluralRules(locales) { | ||
function PluralRules() { | ||
var locales = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -128,7 +204,37 @@ | ||
this._locale = resolveLocale(locales); | ||
this._select = getSelector(this._locale); | ||
this._range = getRangeSelector(this._locale); | ||
this._type = getType(opt.type); | ||
this._nf = new NumberFormat('en', opt); // make-plural expects latin digits with . decimal separator | ||
_classPrivateFieldInitSpec(this, _locale, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldInitSpec(this, _range, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldInitSpec(this, _select, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldInitSpec(this, _type, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldInitSpec(this, _nf, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldSet(this, _locale, resolveLocale(locales)); | ||
_classPrivateFieldSet(this, _select, getSelector(_classPrivateFieldGet(this, _locale))); | ||
_classPrivateFieldSet(this, _range, getRangeSelector(_classPrivateFieldGet(this, _locale))); | ||
_classPrivateFieldSet(this, _type, getType(opt)); | ||
_classPrivateFieldSet(this, _nf, new NumberFormat('en', opt)); // make-plural expects latin digits with . decimal separator | ||
} | ||
@@ -139,18 +245,16 @@ | ||
value: function resolvedOptions() { | ||
var _this$_nf$resolvedOpt = this._nf.resolvedOptions(), | ||
minimumIntegerDigits = _this$_nf$resolvedOpt.minimumIntegerDigits, | ||
minimumFractionDigits = _this$_nf$resolvedOpt.minimumFractionDigits, | ||
maximumFractionDigits = _this$_nf$resolvedOpt.maximumFractionDigits, | ||
minimumSignificantDigits = _this$_nf$resolvedOpt.minimumSignificantDigits, | ||
maximumSignificantDigits = _this$_nf$resolvedOpt.maximumSignificantDigits, | ||
roundingPriority = _this$_nf$resolvedOpt.roundingPriority; | ||
var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _nf).resolvedOptions(), | ||
minimumIntegerDigits = _classPrivateFieldGet2.minimumIntegerDigits, | ||
minimumFractionDigits = _classPrivateFieldGet2.minimumFractionDigits, | ||
maximumFractionDigits = _classPrivateFieldGet2.maximumFractionDigits, | ||
minimumSignificantDigits = _classPrivateFieldGet2.minimumSignificantDigits, | ||
maximumSignificantDigits = _classPrivateFieldGet2.maximumSignificantDigits, | ||
roundingPriority = _classPrivateFieldGet2.roundingPriority; | ||
var opt = { | ||
locale: this._locale, | ||
locale: _classPrivateFieldGet(this, _locale), | ||
type: _classPrivateFieldGet(this, _type), | ||
minimumIntegerDigits: minimumIntegerDigits, | ||
minimumFractionDigits: minimumFractionDigits, | ||
maximumFractionDigits: maximumFractionDigits, | ||
pluralCategories: getCategories(this._locale, this._type === 'ordinal'), | ||
roundingPriority: roundingPriority || 'auto', | ||
type: this._type | ||
maximumFractionDigits: maximumFractionDigits | ||
}; | ||
@@ -163,2 +267,4 @@ | ||
opt.pluralCategories = getCategories(_classPrivateFieldGet(this, _locale), _classPrivateFieldGet(this, _type) === 'ordinal').slice(0); | ||
opt.roundingPriority = roundingPriority || 'auto'; | ||
return opt; | ||
@@ -173,5 +279,5 @@ } | ||
var fmt = this._nf.format(Math.abs(number)); | ||
var fmt = _classPrivateFieldGet(this, _nf).format(Math.abs(number)); | ||
return this._select(fmt, this._type === 'ordinal'); | ||
return _classPrivateFieldGet(this, _select).call(this, fmt, _classPrivateFieldGet(this, _type) === 'ordinal'); | ||
} | ||
@@ -182,6 +288,9 @@ }, { | ||
if (!(this instanceof PluralRules)) throw new TypeError("selectRange() called on incompatible ".concat(this)); | ||
if (typeof start !== 'number') start = Number(start); | ||
if (typeof end !== 'number') end = Number(end); | ||
if (!isFinite(start) || !isFinite(end) || start > end) throw new RangeError('start and end must be finite, with end >= start'); | ||
return this._range(this.select(start), this.select(end)); | ||
if (start === undefined) throw new TypeError('start is undefined'); | ||
if (end === undefined) throw new TypeError('end is undefined'); | ||
var start_ = toNumber(start); | ||
var end_ = toNumber(end); | ||
if (!isFinite(start_)) throw new RangeError('start must be finite'); | ||
if (!isFinite(end_)) throw new RangeError('end must be finite'); | ||
return _classPrivateFieldGet(this, _range).call(this, this.select(start_), this.select(end_)); | ||
} | ||
@@ -198,2 +307,10 @@ }], [{ | ||
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
Object.defineProperty(PluralRules.prototype, Symbol.toStringTag, { | ||
value: 'Intl.PluralRules', | ||
writable: false, | ||
configurable: true | ||
}); | ||
} | ||
Object.defineProperty(PluralRules, 'prototype', { | ||
@@ -200,0 +317,0 @@ writable: false |
{ | ||
"name": "intl-pluralrules", | ||
"version": "2.0.0-0", | ||
"version": "2.0.0-1", | ||
"description": "Intl.PluralRules polyfill", | ||
@@ -19,3 +19,2 @@ "keywords": [ | ||
"plural-rules.*", | ||
"pseudo-number-format.*", | ||
"polyfill.*" | ||
@@ -36,3 +35,2 @@ ], | ||
"./polyfill": "./polyfill.js", | ||
"./pseudo-number-format": "./pseudo-number-format.js", | ||
"./package.json": "./package.json" | ||
@@ -46,17 +44,5 @@ }, | ||
}, | ||
"jest": { | ||
"collectCoverage": true, | ||
"moduleFileExtensions": [ | ||
"mjs", | ||
"js", | ||
"json" | ||
], | ||
"testMatch": [ | ||
"**/*.test.mjs" | ||
], | ||
"transform": { | ||
"\\.mjs$": "babel-jest" | ||
}, | ||
"transformIgnorePatterns": [] | ||
}, | ||
"browserslist": [ | ||
"> 0.25%, not dead" | ||
], | ||
"prettier": { | ||
@@ -74,7 +60,10 @@ "arrowParens": "avoid", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"babel-jest": "^27.0.6", | ||
"jest": "^27.0.6", | ||
"c8": "^7.12.0", | ||
"chai": "^4.3.6", | ||
"make-plural": "^7.0.0", | ||
"mocha": "^10.0.0", | ||
"mocha-selenium-bridge": "^0.2.3", | ||
"rollup": "^2.26.5", | ||
"rollup-plugin-terser": "^7.0.0" | ||
"rollup-plugin-terser": "^7.0.0", | ||
"test262-harness": "^10.0.0" | ||
}, | ||
@@ -85,4 +74,8 @@ "scripts": { | ||
"prepublishOnly": "npm test && npm run build", | ||
"test": "jest" | ||
"test": "c8 mocha test/*.test.mjs", | ||
"pretest262": "rollup -c test/rollup.test262.js", | ||
"test262": "test262-harness --error-for-failures --features-exclude cross-realm --prelude test/dist/test262-prelude.js 'test262/test/intl402/PluralRules/**/*.js'", | ||
"pretest:ie11": "npx rollup -c test/rollup.browser.js", | ||
"test:ie11": "mocha-selenium-bridge --driver ./test/browserstack-driver.js http://localhost:8000/test/browser-test.html" | ||
} | ||
} |
'use strict'; | ||
var getPluralRules = require('./factory'); | ||
var PseudoNumberFormat = require('./pseudo-number-format'); | ||
var getPluralRules = require('./factory.js'); | ||
@@ -9,35 +8,18 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
function _mergeNamespaces(n, m) { | ||
m.forEach(function (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default' && !(k in n)) { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
}); | ||
return Object.freeze(n); | ||
m.forEach(function (e) { | ||
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { | ||
if (k !== 'default' && !(k in n)) { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { return e[k]; } | ||
}); | ||
} | ||
}); | ||
}); | ||
return Object.freeze(n); | ||
} | ||
var getPluralRules__default = /*#__PURE__*/_interopDefaultLegacy(getPluralRules); | ||
var PseudoNumberFormat__default = /*#__PURE__*/_interopDefaultLegacy(PseudoNumberFormat); | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
@@ -89,3 +71,2 @@ | ||
})(commonjsGlobal, { | ||
_in: e, | ||
af: a, | ||
@@ -124,2 +105,5 @@ ak: b, | ||
}, | ||
bal: function bal(n, ord) { | ||
return n == 1 ? 'one' : 'other'; | ||
}, | ||
be: function be(n, ord) { | ||
@@ -229,3 +213,10 @@ var s = String(n).split('.'), | ||
eo: a, | ||
es: a, | ||
es: function es(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
v0 = !s[1], | ||
i1000000 = i.slice(-6); | ||
if (ord) return 'other'; | ||
return n == 1 ? 'one' : i != 0 && i1000000 == 0 && v0 ? 'many' : 'other'; | ||
}, | ||
et: d, | ||
@@ -303,2 +294,3 @@ eu: a, | ||
}, | ||
hnj: e, | ||
hr: function hr(n, ord) { | ||
@@ -350,20 +342,12 @@ var s = String(n).split('.'), | ||
var s = String(n).split('.'), | ||
v0 = !s[1]; | ||
i = s[0], | ||
v0 = !s[1], | ||
i1000000 = i.slice(-6); | ||
if (ord) return n == 11 || n == 8 || n == 80 || n == 800 ? 'many' : 'other'; | ||
return n == 1 && v0 ? 'one' : 'other'; | ||
return n == 1 && v0 ? 'one' : i != 0 && i1000000 == 0 && v0 ? 'many' : 'other'; | ||
}, | ||
iu: f, | ||
iw: function iw(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
v0 = !s[1], | ||
t0 = Number(s[0]) == n, | ||
n10 = t0 && s[0].slice(-1); | ||
if (ord) return 'other'; | ||
return n == 1 && v0 ? 'one' : i == 2 && v0 ? 'two' : v0 && (n < 0 || n > 10) && t0 && n10 == 0 ? 'many' : 'other'; | ||
}, | ||
ja: e, | ||
jbo: e, | ||
jgo: a, | ||
ji: d, | ||
jmc: a, | ||
@@ -555,7 +539,16 @@ jv: e, | ||
var s = String(n).split('.'), | ||
i = s[0]; | ||
i = s[0], | ||
v0 = !s[1], | ||
i1000000 = i.slice(-6); | ||
if (ord) return 'other'; | ||
return i == 0 || i == 1 ? 'one' : 'other'; | ||
return i == 0 || i == 1 ? 'one' : i != 0 && i1000000 == 0 && v0 ? 'many' : 'other'; | ||
}, | ||
pt_PT: d, | ||
pt_PT: function pt_PT(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
v0 = !s[1], | ||
i1000000 = i.slice(-6); | ||
if (ord) return 'other'; | ||
return n == 1 && v0 ? 'one' : i != 0 && i1000000 == 0 && v0 ? 'many' : 'other'; | ||
}, | ||
rm: a, | ||
@@ -571,3 +564,2 @@ ro: function ro(n, ord) { | ||
rof: a, | ||
root: e, | ||
ru: function ru(n, ord) { | ||
@@ -711,2 +703,3 @@ var s = String(n).split('.'), | ||
to: e, | ||
tpi: e, | ||
tr: a, | ||
@@ -733,2 +726,3 @@ ts: a, | ||
}, | ||
und: e, | ||
ur: d, | ||
@@ -758,6 +752,6 @@ uz: a, | ||
var P = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
'default': plurals | ||
}, [plurals$1.exports])); | ||
var P = /*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
'default': plurals | ||
}, [plurals$1.exports]); | ||
@@ -778,13 +772,13 @@ var pluralCategories$1 = {exports: {}}; | ||
var b = { | ||
cardinal: [o, x], | ||
ordinal: [o, x] | ||
}; | ||
var c = { | ||
cardinal: [x], | ||
ordinal: [x] | ||
}; | ||
var c = { | ||
var d = { | ||
cardinal: [o, f, m, x], | ||
ordinal: [x] | ||
}; | ||
var d = { | ||
cardinal: [o, x], | ||
ordinal: [o, x] | ||
}; | ||
var e = { | ||
@@ -801,3 +795,2 @@ cardinal: [o, t, x], | ||
})(commonjsGlobal, { | ||
_in: b, | ||
af: a, | ||
@@ -825,2 +818,3 @@ ak: a, | ||
}, | ||
bal: b, | ||
be: { | ||
@@ -834,3 +828,3 @@ cardinal: [o, f, m, x], | ||
bho: a, | ||
bm: b, | ||
bm: c, | ||
bn: { | ||
@@ -840,3 +834,3 @@ cardinal: [o, x], | ||
}, | ||
bo: b, | ||
bo: c, | ||
br: { | ||
@@ -860,3 +854,3 @@ cardinal: [o, t, f, m, x], | ||
ckb: a, | ||
cs: c, | ||
cs: d, | ||
cy: { | ||
@@ -874,3 +868,3 @@ cardinal: [z, o, t, f, m, x], | ||
dv: a, | ||
dz: b, | ||
dz: c, | ||
ee: a, | ||
@@ -883,3 +877,6 @@ el: a, | ||
eo: a, | ||
es: a, | ||
es: { | ||
cardinal: [o, m, x], | ||
ordinal: [x] | ||
}, | ||
et: a, | ||
@@ -890,3 +887,3 @@ eu: a, | ||
fi: a, | ||
fil: d, | ||
fil: b, | ||
fo: a, | ||
@@ -928,2 +925,3 @@ fr: { | ||
}, | ||
hnj: c, | ||
hr: { | ||
@@ -937,26 +935,21 @@ cardinal: [o, f, x], | ||
}, | ||
hu: d, | ||
hy: d, | ||
hu: b, | ||
hy: b, | ||
ia: a, | ||
id: b, | ||
ig: b, | ||
ii: b, | ||
id: c, | ||
ig: c, | ||
ii: c, | ||
io: a, | ||
is: a, | ||
it: { | ||
cardinal: [o, x], | ||
cardinal: [o, m, x], | ||
ordinal: [m, x] | ||
}, | ||
iu: e, | ||
iw: { | ||
cardinal: [o, t, m, x], | ||
ordinal: [x] | ||
}, | ||
ja: b, | ||
jbo: b, | ||
ja: c, | ||
jbo: c, | ||
jgo: a, | ||
ji: a, | ||
jmc: a, | ||
jv: b, | ||
jw: b, | ||
jv: c, | ||
jw: c, | ||
ka: { | ||
@@ -969,4 +962,4 @@ cardinal: [o, x], | ||
kcg: a, | ||
kde: b, | ||
kea: b, | ||
kde: c, | ||
kea: c, | ||
kk: { | ||
@@ -978,5 +971,5 @@ cardinal: [o, x], | ||
kl: a, | ||
km: b, | ||
km: c, | ||
kn: a, | ||
ko: b, | ||
ko: c, | ||
ks: a, | ||
@@ -1004,3 +997,3 @@ ksb: a, | ||
}, | ||
lkt: b, | ||
lkt: c, | ||
ln: a, | ||
@@ -1011,3 +1004,3 @@ lo: { | ||
}, | ||
lt: c, | ||
lt: d, | ||
lv: { | ||
@@ -1038,4 +1031,4 @@ cardinal: [z, o, x], | ||
}, | ||
mt: c, | ||
my: b, | ||
mt: d, | ||
my: c, | ||
nah: a, | ||
@@ -1045,3 +1038,3 @@ naq: e, | ||
nd: a, | ||
ne: d, | ||
ne: b, | ||
nl: a, | ||
@@ -1051,3 +1044,3 @@ nn: a, | ||
no: a, | ||
nqo: b, | ||
nqo: c, | ||
nr: a, | ||
@@ -1063,7 +1056,7 @@ nso: a, | ||
os: a, | ||
osa: b, | ||
osa: c, | ||
pa: a, | ||
pap: a, | ||
pcm: a, | ||
pl: c, | ||
pl: d, | ||
prg: { | ||
@@ -1074,4 +1067,10 @@ cardinal: [z, o, x], | ||
ps: a, | ||
pt: a, | ||
pt_PT: a, | ||
pt: { | ||
cardinal: [o, m, x], | ||
ordinal: [x] | ||
}, | ||
pt_PT: { | ||
cardinal: [o, m, x], | ||
ordinal: [x] | ||
}, | ||
rm: a, | ||
@@ -1083,6 +1082,5 @@ ro: { | ||
rof: a, | ||
root: b, | ||
ru: c, | ||
ru: d, | ||
rwk: a, | ||
sah: b, | ||
sah: c, | ||
saq: a, | ||
@@ -1102,4 +1100,4 @@ sat: e, | ||
seh: a, | ||
ses: b, | ||
sg: b, | ||
ses: c, | ||
sg: c, | ||
sh: { | ||
@@ -1114,3 +1112,3 @@ cardinal: [o, f, x], | ||
si: a, | ||
sk: c, | ||
sk: d, | ||
sl: { | ||
@@ -1138,4 +1136,4 @@ cardinal: [o, t, f, x], | ||
st: a, | ||
su: b, | ||
sv: d, | ||
su: c, | ||
sv: b, | ||
sw: a, | ||
@@ -1146,3 +1144,3 @@ syr: a, | ||
teo: a, | ||
th: b, | ||
th: c, | ||
ti: a, | ||
@@ -1154,5 +1152,6 @@ tig: a, | ||
}, | ||
tl: d, | ||
tl: b, | ||
tn: a, | ||
to: b, | ||
to: c, | ||
tpi: c, | ||
tr: a, | ||
@@ -1166,2 +1165,3 @@ ts: a, | ||
}, | ||
und: c, | ||
ur: a, | ||
@@ -1178,9 +1178,9 @@ uz: a, | ||
wae: a, | ||
wo: b, | ||
wo: c, | ||
xh: a, | ||
xog: a, | ||
yi: a, | ||
yo: b, | ||
yue: b, | ||
zh: b, | ||
yo: c, | ||
yue: c, | ||
zh: c, | ||
zu: a | ||
@@ -1192,6 +1192,6 @@ }); | ||
var C = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
'default': pluralCategories | ||
}, [pluralCategories$1.exports])); | ||
var C = /*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
'default': pluralCategories | ||
}, [pluralCategories$1.exports]); | ||
@@ -1329,6 +1329,6 @@ var ranges$1 = {exports: {}}; | ||
var R = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
'default': ranges | ||
}, [ranges$1.exports])); | ||
var R = /*#__PURE__*/_mergeNamespaces({ | ||
__proto__: null, | ||
'default': ranges | ||
}, [ranges$1.exports]); | ||
@@ -1340,9 +1340,6 @@ // using them here because with this many small functions, bundlers produce less | ||
var Categories = pluralCategories || C; | ||
var RangePlurals = ranges || R; | ||
/* istanbul ignore next */ | ||
var RangePlurals = ranges || R; // make-plural exports are cast with safe-identifier to be valid JS identifiers | ||
var NumberFormat = (typeof Intl === "undefined" ? "undefined" : _typeof(Intl)) === 'object' && Intl.NumberFormat || PseudoNumberFormat__default["default"]; // make-plural exports are cast with safe-identifier to be valid JS identifiers | ||
var id = function id(lc) { | ||
return lc === 'in' ? '_in' : lc === 'pt-PT' ? 'pt_PT' : lc; | ||
return lc === 'pt-PT' ? 'pt_PT' : lc; | ||
}; | ||
@@ -1362,4 +1359,4 @@ | ||
var PluralRules = getPluralRules__default["default"](NumberFormat, getSelector, getCategories, getRangeSelector); | ||
var PluralRules = getPluralRules__default["default"](Intl.NumberFormat, getSelector, getCategories, getRangeSelector); | ||
module.exports = PluralRules; |
'use strict'; | ||
var PluralRules = require('./plural-rules'); | ||
var PluralRules = require('./plural-rules.js'); | ||
@@ -5,0 +5,0 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } |
@@ -76,3 +76,3 @@ # intl-pluralrules | ||
const range = { en: enRange, fr: frRange } | ||
const getRangeSelector = (lc) => range[lc] | ||
const getRangeSelector = lc => range[lc] | ||
@@ -92,5 +92,4 @@ const PluralRules = getPluralRules( | ||
- `NumberFormat` should be `Intl.NumberFormat`, or a minimal implementation | ||
such as the one available at `intl-pluralrules/pseudo-number-format`. It | ||
should at least support the `"en"` locale and all of the min/max digit count | ||
- `NumberFormat` should be `Intl.NumberFormat`, or an implementation which | ||
supports at least the `"en"` locale and all of the min/max digit count | ||
options. | ||
@@ -97,0 +96,0 @@ - `getSelector(lc)` should return a `function(n, ord)` returning the plural |
Sorry, the diff of this file is not supported yet
63425
1803
13
9
106