intl-pluralrules
Advanced tools
Comparing version 2.0.0 to 2.0.1
196
factory.js
'use strict'; | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
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); | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
Object.defineProperty(Constructor, "prototype", { | ||
writable: false | ||
}); | ||
return Constructor; | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || "default"); | ||
if (typeof res !== "object") return res; | ||
throw new TypeError("@@toPrimitive must return a primitive value."); | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} | ||
function _classPrivateFieldGet(receiver, privateMap) { | ||
@@ -44,10 +89,10 @@ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); | ||
const canonicalizeLocaleList = locales => { | ||
var canonicalizeLocaleList = function canonicalizeLocaleList(locales) { | ||
if (!locales) return []; | ||
if (!Array.isArray(locales)) locales = [locales]; | ||
const res = {}; | ||
for (let i = 0; i < locales.length; ++i) { | ||
var res = {}; | ||
for (var i = 0; i < locales.length; ++i) { | ||
var _in$iw$ji$lc; | ||
let tag = locales[i]; | ||
if (tag && typeof tag === 'object') tag = String(tag); | ||
var tag = locales[i]; | ||
if (tag && _typeof(tag) === 'object') tag = String(tag); | ||
if (typeof tag !== 'string') { | ||
@@ -57,16 +102,18 @@ // Requiring tag to be a String or Object means that the Number value | ||
// for Min Nan Chinese. | ||
const msg = "Locales should be strings, ".concat(JSON.stringify(tag), " isn't."); | ||
var msg = "Locales should be strings, ".concat(JSON.stringify(tag), " isn't."); | ||
throw new TypeError(msg); | ||
} | ||
const parts = tag.split('-'); | ||
var parts = tag.split('-'); | ||
// does not check for duplicate subtags | ||
if (!parts.every(subtag => /[a-z0-9]+/i.test(subtag))) { | ||
const strTag = JSON.stringify(tag); | ||
const msg = "The locale ".concat(strTag, " is not a structurally valid BCP 47 language tag."); | ||
throw new RangeError(msg); | ||
if (!parts.every(function (subtag) { | ||
return /[a-z0-9]+/i.test(subtag); | ||
})) { | ||
var strTag = JSON.stringify(tag); | ||
var _msg = "The locale ".concat(strTag, " is not a structurally valid BCP 47 language tag."); | ||
throw new RangeError(_msg); | ||
} | ||
// always use lower case for primary language subtag | ||
let lc = parts[0].toLowerCase(); | ||
var lc = parts[0].toLowerCase(); | ||
// replace deprecated codes for Indonesian, Hebrew & Yiddish | ||
@@ -83,3 +130,3 @@ parts[0] = (_in$iw$ji$lc = { | ||
function getType(opt) { | ||
const type = Object.prototype.hasOwnProperty.call(opt, 'type') && opt.type; | ||
var type = Object.prototype.hasOwnProperty.call(opt, 'type') && opt.type; | ||
if (!type) return 'cardinal'; | ||
@@ -90,3 +137,3 @@ if (type === 'cardinal' || type === 'ordinal') return type; | ||
function toNumber(value) { | ||
switch (typeof value) { | ||
switch (_typeof(value)) { | ||
case 'number': | ||
@@ -101,3 +148,3 @@ return value; | ||
function getPluralRules(NumberFormat, getSelector, getCategories, getRangeSelector) { | ||
const findLocale = locale => { | ||
var findLocale = function findLocale(locale) { | ||
do { | ||
@@ -109,9 +156,9 @@ if (getSelector(locale)) return locale; | ||
}; | ||
const resolveLocale = locales => { | ||
const canonicalLocales = canonicalizeLocaleList(locales); | ||
for (let i = 0; i < canonicalLocales.length; ++i) { | ||
const lc = findLocale(canonicalLocales[i]); | ||
if (lc) return lc; | ||
var resolveLocale = function resolveLocale(locales) { | ||
var canonicalLocales = canonicalizeLocaleList(locales); | ||
for (var i = 0; i < canonicalLocales.length; ++i) { | ||
var _lc = findLocale(canonicalLocales[i]); | ||
if (_lc) return _lc; | ||
} | ||
const lc = new NumberFormat().resolvedOptions().locale; | ||
var lc = new NumberFormat().resolvedOptions().locale; | ||
return findLocale(lc); | ||
@@ -124,9 +171,7 @@ }; | ||
var _nf = /*#__PURE__*/new WeakMap(); | ||
class PluralRules { | ||
static supportedLocalesOf(locales) { | ||
return canonicalizeLocaleList(locales).filter(findLocale); | ||
} | ||
constructor() { | ||
let locales = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var PluralRules = /*#__PURE__*/function () { | ||
function PluralRules() { | ||
var locales = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
_classCallCheck(this, PluralRules); | ||
_classPrivateFieldInitSpec(this, _locale, { | ||
@@ -158,45 +203,56 @@ writable: true, | ||
} | ||
resolvedOptions() { | ||
const { | ||
minimumIntegerDigits, | ||
minimumFractionDigits, | ||
maximumFractionDigits, | ||
minimumSignificantDigits, | ||
maximumSignificantDigits, | ||
roundingPriority | ||
} = _classPrivateFieldGet(this, _nf).resolvedOptions(); | ||
const opt = { | ||
locale: _classPrivateFieldGet(this, _locale), | ||
type: _classPrivateFieldGet(this, _type), | ||
minimumIntegerDigits, | ||
minimumFractionDigits, | ||
maximumFractionDigits | ||
}; | ||
if (typeof minimumSignificantDigits === 'number') { | ||
opt.minimumSignificantDigits = minimumSignificantDigits; | ||
opt.maximumSignificantDigits = maximumSignificantDigits; | ||
_createClass(PluralRules, [{ | ||
key: "resolvedOptions", | ||
value: function resolvedOptions() { | ||
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: _classPrivateFieldGet(this, _locale), | ||
type: _classPrivateFieldGet(this, _type), | ||
minimumIntegerDigits: minimumIntegerDigits, | ||
minimumFractionDigits: minimumFractionDigits, | ||
maximumFractionDigits: maximumFractionDigits | ||
}; | ||
if (typeof minimumSignificantDigits === 'number') { | ||
opt.minimumSignificantDigits = minimumSignificantDigits; | ||
opt.maximumSignificantDigits = maximumSignificantDigits; | ||
} | ||
opt.pluralCategories = getCategories(_classPrivateFieldGet(this, _locale), _classPrivateFieldGet(this, _type) === 'ordinal').slice(0); | ||
opt.roundingPriority = roundingPriority || 'auto'; | ||
return opt; | ||
} | ||
opt.pluralCategories = getCategories(_classPrivateFieldGet(this, _locale), _classPrivateFieldGet(this, _type) === 'ordinal').slice(0); | ||
opt.roundingPriority = roundingPriority || 'auto'; | ||
return opt; | ||
} | ||
select(number) { | ||
if (!(this instanceof PluralRules)) throw new TypeError("select() called on incompatible ".concat(this)); | ||
if (typeof number !== 'number') number = Number(number); | ||
if (!isFinite(number)) return 'other'; | ||
const fmt = _classPrivateFieldGet(this, _nf).format(Math.abs(number)); | ||
return _classPrivateFieldGet(this, _select).call(this, fmt, _classPrivateFieldGet(this, _type) === 'ordinal'); | ||
} | ||
selectRange(start, end) { | ||
if (!(this instanceof PluralRules)) throw new TypeError("selectRange() called on incompatible ".concat(this)); | ||
if (start === undefined) throw new TypeError('start is undefined'); | ||
if (end === undefined) throw new TypeError('end is undefined'); | ||
const start_ = toNumber(start); | ||
const 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_)); | ||
} | ||
} | ||
}, { | ||
key: "select", | ||
value: function select(number) { | ||
if (!(this instanceof PluralRules)) throw new TypeError("select() called on incompatible ".concat(this)); | ||
if (typeof number !== 'number') number = Number(number); | ||
if (!isFinite(number)) return 'other'; | ||
var fmt = _classPrivateFieldGet(this, _nf).format(Math.abs(number)); | ||
return _classPrivateFieldGet(this, _select).call(this, fmt, _classPrivateFieldGet(this, _type) === 'ordinal'); | ||
} | ||
}, { | ||
key: "selectRange", | ||
value: function selectRange(start, end) { | ||
if (!(this instanceof PluralRules)) throw new TypeError("selectRange() called on incompatible ".concat(this)); | ||
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_)); | ||
} | ||
}], [{ | ||
key: "supportedLocalesOf", | ||
value: function supportedLocalesOf(locales) { | ||
return canonicalizeLocaleList(locales).filter(findLocale); | ||
} | ||
}]); | ||
return PluralRules; | ||
}(); | ||
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { | ||
@@ -203,0 +259,0 @@ Object.defineProperty(PluralRules.prototype, Symbol.toStringTag, { |
{ | ||
"name": "intl-pluralrules", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Intl.PluralRules polyfill", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"react-native": { | ||
"./factory": "./factory.js" | ||
"./factory.js": "./factory.js" | ||
}, | ||
@@ -58,3 +58,3 @@ "browserslist": [ | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"c8": "^7.12.0", | ||
"c8": "^8.0.0", | ||
"chai": "^4.3.6", | ||
@@ -61,0 +61,0 @@ "make-plural": "^7.0.0", |
@@ -33,16 +33,16 @@ 'use strict'; | ||
(function (module, exports) { | ||
const a = (n, ord) => { | ||
var a = function a(n, ord) { | ||
if (ord) return 'other'; | ||
return n == 1 ? 'one' : 'other'; | ||
}; | ||
const b = (n, ord) => { | ||
var b = function b(n, ord) { | ||
if (ord) return 'other'; | ||
return n == 0 || n == 1 ? 'one' : 'other'; | ||
}; | ||
const c = (n, ord) => { | ||
var c = function c(n, ord) { | ||
if (ord) return 'other'; | ||
return n >= 0 && n <= 1 ? 'one' : 'other'; | ||
}; | ||
const d = (n, ord) => { | ||
const s = String(n).split('.'), | ||
var d = function d(n, ord) { | ||
var s = String(n).split('.'), | ||
v0 = !s[1]; | ||
@@ -52,4 +52,6 @@ if (ord) return 'other'; | ||
}; | ||
const e = (n, ord) => 'other'; | ||
const f = (n, ord) => { | ||
var e = function e(n, ord) { | ||
return 'other'; | ||
}; | ||
var f = function f(n, ord) { | ||
if (ord) return 'other'; | ||
@@ -68,4 +70,4 @@ return n == 1 ? 'one' : n == 2 ? 'two' : 'other'; | ||
an: a, | ||
ar: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ar: function ar(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -76,4 +78,4 @@ n100 = t0 && s[0].slice(-2); | ||
}, | ||
ars: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ars: function ars(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -84,3 +86,3 @@ n100 = t0 && s[0].slice(-2); | ||
}, | ||
as: (n, ord) => { | ||
as: function as(n, ord) { | ||
if (ord) return n == 1 || n == 5 || n == 7 || n == 8 || n == 9 || n == 10 ? 'one' : n == 2 || n == 3 ? 'two' : n == 4 ? 'few' : n == 6 ? 'many' : 'other'; | ||
@@ -91,4 +93,4 @@ return n >= 0 && n <= 1 ? 'one' : 'other'; | ||
ast: d, | ||
az: (n, ord) => { | ||
const s = String(n).split('.'), | ||
az: function az(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -101,5 +103,7 @@ i10 = i.slice(-1), | ||
}, | ||
bal: (n, ord) => n == 1 ? 'one' : 'other', | ||
be: (n, ord) => { | ||
const s = String(n).split('.'), | ||
bal: function bal(n, ord) { | ||
return n == 1 ? 'one' : 'other'; | ||
}, | ||
be: function be(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -116,3 +120,3 @@ n10 = t0 && s[0].slice(-1), | ||
bm: e, | ||
bn: (n, ord) => { | ||
bn: function bn(n, ord) { | ||
if (ord) return n == 1 || n == 5 || n == 7 || n == 8 || n == 9 || n == 10 ? 'one' : n == 2 || n == 3 ? 'two' : n == 4 ? 'few' : n == 6 ? 'many' : 'other'; | ||
@@ -122,4 +126,4 @@ return n >= 0 && n <= 1 ? 'one' : 'other'; | ||
bo: e, | ||
br: (n, ord) => { | ||
const s = String(n).split('.'), | ||
br: function br(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -133,4 +137,4 @@ n10 = t0 && s[0].slice(-1), | ||
brx: a, | ||
bs: (n, ord) => { | ||
const s = String(n).split('.'), | ||
bs: function bs(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -146,4 +150,4 @@ f = s[1] || '', | ||
}, | ||
ca: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ca: function ca(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -156,4 +160,4 @@ v0 = !s[1], | ||
ce: a, | ||
ceb: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ceb: function ceb(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -170,4 +174,4 @@ f = s[1] || '', | ||
ckb: a, | ||
cs: (n, ord) => { | ||
const s = String(n).split('.'), | ||
cs: function cs(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -178,8 +182,8 @@ v0 = !s[1]; | ||
}, | ||
cy: (n, ord) => { | ||
cy: function cy(n, ord) { | ||
if (ord) return n == 0 || n == 7 || n == 8 || n == 9 ? 'zero' : n == 1 ? 'one' : n == 2 ? 'two' : n == 3 || n == 4 ? 'few' : n == 5 || n == 6 ? 'many' : 'other'; | ||
return n == 0 ? 'zero' : n == 1 ? 'one' : n == 2 ? 'two' : n == 3 ? 'few' : n == 6 ? 'many' : 'other'; | ||
}, | ||
da: (n, ord) => { | ||
const s = String(n).split('.'), | ||
da: function da(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -192,4 +196,4 @@ t0 = Number(s[0]) == n; | ||
doi: c, | ||
dsb: (n, ord) => { | ||
const s = String(n).split('.'), | ||
dsb: function dsb(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -207,4 +211,4 @@ f = s[1] || '', | ||
el: a, | ||
en: (n, ord) => { | ||
const s = String(n).split('.'), | ||
en: function en(n, ord) { | ||
var s = String(n).split('.'), | ||
v0 = !s[1], | ||
@@ -218,4 +222,4 @@ t0 = Number(s[0]) == n, | ||
eo: a, | ||
es: (n, ord) => { | ||
const s = String(n).split('.'), | ||
es: function es(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -230,3 +234,3 @@ v0 = !s[1], | ||
fa: c, | ||
ff: (n, ord) => { | ||
ff: function ff(n, ord) { | ||
if (ord) return 'other'; | ||
@@ -236,4 +240,4 @@ return n >= 0 && n < 2 ? 'one' : 'other'; | ||
fi: d, | ||
fil: (n, ord) => { | ||
const s = String(n).split('.'), | ||
fil: function fil(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -248,4 +252,4 @@ f = s[1] || '', | ||
fo: a, | ||
fr: (n, ord) => { | ||
const s = String(n).split('.'), | ||
fr: function fr(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -259,4 +263,4 @@ v0 = !s[1], | ||
fy: d, | ||
ga: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ga: function ga(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n; | ||
@@ -266,4 +270,4 @@ if (ord) return n == 1 ? 'one' : 'other'; | ||
}, | ||
gd: (n, ord) => { | ||
const s = String(n).split('.'), | ||
gd: function gd(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n; | ||
@@ -275,3 +279,3 @@ if (ord) return n == 1 || n == 11 ? 'one' : n == 2 || n == 12 ? 'two' : n == 3 || n == 13 ? 'few' : 'other'; | ||
gsw: a, | ||
gu: (n, ord) => { | ||
gu: function gu(n, ord) { | ||
if (ord) return n == 1 ? 'one' : n == 2 || n == 3 ? 'two' : n == 4 ? 'few' : n == 6 ? 'many' : 'other'; | ||
@@ -281,4 +285,4 @@ return n >= 0 && n <= 1 ? 'one' : 'other'; | ||
guw: b, | ||
gv: (n, ord) => { | ||
const s = String(n).split('.'), | ||
gv: function gv(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -293,4 +297,4 @@ v0 = !s[1], | ||
haw: a, | ||
he: (n, ord) => { | ||
const s = String(n).split('.'), | ||
he: function he(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -301,3 +305,3 @@ v0 = !s[1]; | ||
}, | ||
hi: (n, ord) => { | ||
hi: function hi(n, ord) { | ||
if (ord) return n == 1 ? 'one' : n == 2 || n == 3 ? 'two' : n == 4 ? 'few' : n == 6 ? 'many' : 'other'; | ||
@@ -307,4 +311,4 @@ return n >= 0 && n <= 1 ? 'one' : 'other'; | ||
hnj: e, | ||
hr: (n, ord) => { | ||
const s = String(n).split('.'), | ||
hr: function hr(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -320,4 +324,4 @@ f = s[1] || '', | ||
}, | ||
hsb: (n, ord) => { | ||
const s = String(n).split('.'), | ||
hsb: function hsb(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -331,7 +335,7 @@ f = s[1] || '', | ||
}, | ||
hu: (n, ord) => { | ||
hu: function hu(n, ord) { | ||
if (ord) return n == 1 || n == 5 ? 'one' : 'other'; | ||
return n == 1 ? 'one' : 'other'; | ||
}, | ||
hy: (n, ord) => { | ||
hy: function hy(n, ord) { | ||
if (ord) return n == 1 ? 'one' : 'other'; | ||
@@ -345,4 +349,4 @@ return n >= 0 && n < 2 ? 'one' : 'other'; | ||
io: d, | ||
is: (n, ord) => { | ||
const s = String(n).split('.'), | ||
is: function is(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -356,4 +360,4 @@ t = (s[1] || '').replace(/0+$/, ''), | ||
}, | ||
it: (n, ord) => { | ||
const s = String(n).split('.'), | ||
it: function it(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -372,4 +376,4 @@ v0 = !s[1], | ||
jw: e, | ||
ka: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ka: function ka(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -380,3 +384,3 @@ i100 = i.slice(-2); | ||
}, | ||
kab: (n, ord) => { | ||
kab: function kab(n, ord) { | ||
if (ord) return 'other'; | ||
@@ -389,4 +393,4 @@ return n >= 0 && n < 2 ? 'one' : 'other'; | ||
kea: e, | ||
kk: (n, ord) => { | ||
const s = String(n).split('.'), | ||
kk: function kk(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -404,3 +408,3 @@ n10 = t0 && s[0].slice(-1); | ||
ksb: a, | ||
ksh: (n, ord) => { | ||
ksh: function ksh(n, ord) { | ||
if (ord) return 'other'; | ||
@@ -410,4 +414,4 @@ return n == 0 ? 'zero' : n == 1 ? 'one' : 'other'; | ||
ku: a, | ||
kw: (n, ord) => { | ||
const s = String(n).split('.'), | ||
kw: function kw(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -422,4 +426,4 @@ n100 = t0 && s[0].slice(-2), | ||
ky: a, | ||
lag: (n, ord) => { | ||
const s = String(n).split('.'), | ||
lag: function lag(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0]; | ||
@@ -431,4 +435,4 @@ if (ord) return 'other'; | ||
lg: a, | ||
lij: (n, ord) => { | ||
const s = String(n).split('.'), | ||
lij: function lij(n, ord) { | ||
var s = String(n).split('.'), | ||
v0 = !s[1], | ||
@@ -441,8 +445,8 @@ t0 = Number(s[0]) == n; | ||
ln: b, | ||
lo: (n, ord) => { | ||
lo: function lo(n, ord) { | ||
if (ord) return n == 1 ? 'one' : 'other'; | ||
return 'other'; | ||
}, | ||
lt: (n, ord) => { | ||
const s = String(n).split('.'), | ||
lt: function lt(n, ord) { | ||
var s = String(n).split('.'), | ||
f = s[1] || '', | ||
@@ -455,4 +459,4 @@ t0 = Number(s[0]) == n, | ||
}, | ||
lv: (n, ord) => { | ||
const s = String(n).split('.'), | ||
lv: function lv(n, ord) { | ||
var s = String(n).split('.'), | ||
f = s[1] || '', | ||
@@ -471,4 +475,4 @@ v = f.length, | ||
mgo: a, | ||
mk: (n, ord) => { | ||
const s = String(n).split('.'), | ||
mk: function mk(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -486,4 +490,4 @@ f = s[1] || '', | ||
mn: a, | ||
mo: (n, ord) => { | ||
const s = String(n).split('.'), | ||
mo: function mo(n, ord) { | ||
var s = String(n).split('.'), | ||
v0 = !s[1], | ||
@@ -495,12 +499,12 @@ t0 = Number(s[0]) == n, | ||
}, | ||
mr: (n, ord) => { | ||
mr: function mr(n, ord) { | ||
if (ord) return n == 1 ? 'one' : n == 2 || n == 3 ? 'two' : n == 4 ? 'few' : 'other'; | ||
return n == 1 ? 'one' : 'other'; | ||
}, | ||
ms: (n, ord) => { | ||
ms: function ms(n, ord) { | ||
if (ord) return n == 1 ? 'one' : 'other'; | ||
return 'other'; | ||
}, | ||
mt: (n, ord) => { | ||
const s = String(n).split('.'), | ||
mt: function mt(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -516,4 +520,4 @@ n100 = t0 && s[0].slice(-2); | ||
nd: a, | ||
ne: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ne: function ne(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n; | ||
@@ -533,4 +537,4 @@ if (ord) return t0 && n >= 1 && n <= 4 ? 'one' : 'other'; | ||
om: a, | ||
or: (n, ord) => { | ||
const s = String(n).split('.'), | ||
or: function or(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n; | ||
@@ -545,4 +549,4 @@ if (ord) return n == 1 || n == 5 || t0 && n >= 7 && n <= 9 ? 'one' : n == 2 || n == 3 ? 'two' : n == 4 ? 'few' : n == 6 ? 'many' : 'other'; | ||
pcm: c, | ||
pl: (n, ord) => { | ||
const s = String(n).split('.'), | ||
pl: function pl(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -555,4 +559,4 @@ v0 = !s[1], | ||
}, | ||
prg: (n, ord) => { | ||
const s = String(n).split('.'), | ||
prg: function prg(n, ord) { | ||
var s = String(n).split('.'), | ||
f = s[1] || '', | ||
@@ -569,4 +573,4 @@ v = f.length, | ||
ps: a, | ||
pt: (n, ord) => { | ||
const s = String(n).split('.'), | ||
pt: function pt(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -578,4 +582,4 @@ v0 = !s[1], | ||
}, | ||
pt_PT: (n, ord) => { | ||
const s = String(n).split('.'), | ||
pt_PT: function pt_PT(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -588,4 +592,4 @@ v0 = !s[1], | ||
rm: a, | ||
ro: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ro: function ro(n, ord) { | ||
var s = String(n).split('.'), | ||
v0 = !s[1], | ||
@@ -598,4 +602,4 @@ t0 = Number(s[0]) == n, | ||
rof: a, | ||
ru: (n, ord) => { | ||
const s = String(n).split('.'), | ||
ru: function ru(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -612,4 +616,4 @@ v0 = !s[1], | ||
sat: f, | ||
sc: (n, ord) => { | ||
const s = String(n).split('.'), | ||
sc: function sc(n, ord) { | ||
var s = String(n).split('.'), | ||
v0 = !s[1]; | ||
@@ -619,4 +623,4 @@ if (ord) return n == 11 || n == 8 || n == 80 || n == 800 ? 'many' : 'other'; | ||
}, | ||
scn: (n, ord) => { | ||
const s = String(n).split('.'), | ||
scn: function scn(n, ord) { | ||
var s = String(n).split('.'), | ||
v0 = !s[1]; | ||
@@ -632,4 +636,4 @@ if (ord) return n == 11 || n == 8 || n == 80 || n == 800 ? 'many' : 'other'; | ||
sg: e, | ||
sh: (n, ord) => { | ||
const s = String(n).split('.'), | ||
sh: function sh(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -645,4 +649,4 @@ f = s[1] || '', | ||
}, | ||
shi: (n, ord) => { | ||
const s = String(n).split('.'), | ||
shi: function shi(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n; | ||
@@ -652,4 +656,4 @@ if (ord) return 'other'; | ||
}, | ||
si: (n, ord) => { | ||
const s = String(n).split('.'), | ||
si: function si(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -660,4 +664,4 @@ f = s[1] || ''; | ||
}, | ||
sk: (n, ord) => { | ||
const s = String(n).split('.'), | ||
sk: function sk(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -668,4 +672,4 @@ v0 = !s[1]; | ||
}, | ||
sl: (n, ord) => { | ||
const s = String(n).split('.'), | ||
sl: function sl(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -684,4 +688,4 @@ v0 = !s[1], | ||
so: a, | ||
sq: (n, ord) => { | ||
const s = String(n).split('.'), | ||
sq: function sq(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -693,4 +697,4 @@ n10 = t0 && s[0].slice(-1), | ||
}, | ||
sr: (n, ord) => { | ||
const s = String(n).split('.'), | ||
sr: function sr(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -710,4 +714,4 @@ f = s[1] || '', | ||
su: e, | ||
sv: (n, ord) => { | ||
const s = String(n).split('.'), | ||
sv: function sv(n, ord) { | ||
var s = String(n).split('.'), | ||
v0 = !s[1], | ||
@@ -728,4 +732,4 @@ t0 = Number(s[0]) == n, | ||
tig: a, | ||
tk: (n, ord) => { | ||
const s = String(n).split('.'), | ||
tk: function tk(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n, | ||
@@ -736,4 +740,4 @@ n10 = t0 && s[0].slice(-1); | ||
}, | ||
tl: (n, ord) => { | ||
const s = String(n).split('.'), | ||
tl: function tl(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -752,4 +756,4 @@ f = s[1] || '', | ||
ts: a, | ||
tzm: (n, ord) => { | ||
const s = String(n).split('.'), | ||
tzm: function tzm(n, ord) { | ||
var s = String(n).split('.'), | ||
t0 = Number(s[0]) == n; | ||
@@ -760,4 +764,4 @@ if (ord) return 'other'; | ||
ug: a, | ||
uk: (n, ord) => { | ||
const s = String(n).split('.'), | ||
uk: function uk(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -777,4 +781,4 @@ v0 = !s[1], | ||
ve: a, | ||
vec: (n, ord) => { | ||
const s = String(n).split('.'), | ||
vec: function vec(n, ord) { | ||
var s = String(n).split('.'), | ||
i = s[0], | ||
@@ -786,3 +790,3 @@ v0 = !s[1], | ||
}, | ||
vi: (n, ord) => { | ||
vi: function vi(n, ord) { | ||
if (ord) return n == 1 ? 'one' : 'other'; | ||
@@ -1239,5 +1243,11 @@ return 'other'; | ||
(function (module, exports) { | ||
const a = (start, end) => "other"; | ||
const b = (start, end) => start === "other" && end === "one" ? "one" : "other"; | ||
const c = (start, end) => end || "other"; | ||
var a = function a(start, end) { | ||
return "other"; | ||
}; | ||
var b = function b(start, end) { | ||
return start === "other" && end === "one" ? "one" : "other"; | ||
}; | ||
var c = function c(start, end) { | ||
return end || "other"; | ||
}; | ||
(function (root, pluralRanges) { | ||
@@ -1253,3 +1263,5 @@ Object.defineProperty(pluralRanges, '__esModule', { | ||
an: a, | ||
ar: (start, end) => end === "few" ? "few" : end === "many" ? "many" : start === "zero" && end === "one" ? "zero" : start === "zero" && end === "two" ? "zero" : "other", | ||
ar: function ar(start, end) { | ||
return end === "few" ? "few" : end === "many" ? "many" : start === "zero" && end === "one" ? "zero" : start === "zero" && end === "two" ? "zero" : "other"; | ||
}, | ||
as: c, | ||
@@ -1290,3 +1302,5 @@ az: c, | ||
ja: a, | ||
ka: (start, end) => start || "other", | ||
ka: function ka(start, end) { | ||
return start || "other"; | ||
}, | ||
kk: c, | ||
@@ -1300,3 +1314,5 @@ km: a, | ||
lt: c, | ||
lv: (start, end) => end === "one" ? "one" : "other", | ||
lv: function lv(start, end) { | ||
return end === "one" ? "one" : "other"; | ||
}, | ||
mk: a, | ||
@@ -1318,3 +1334,5 @@ ml: c, | ||
pt: c, | ||
ro: (start, end) => end === "few" ? "few" : end === "one" ? "few" : "other", | ||
ro: function ro(start, end) { | ||
return end === "few" ? "few" : end === "one" ? "few" : "other"; | ||
}, | ||
ru: c, | ||
@@ -1324,5 +1342,9 @@ sc: c, | ||
sd: b, | ||
si: (start, end) => start === "one" && end === "one" ? "one" : "other", | ||
si: function si(start, end) { | ||
return start === "one" && end === "one" ? "one" : "other"; | ||
}, | ||
sk: c, | ||
sl: (start, end) => end === "few" ? "few" : end === "one" ? "few" : end === "two" ? "two" : "other", | ||
sl: function sl(start, end) { | ||
return end === "few" ? "few" : end === "one" ? "few" : end === "two" ? "two" : "other"; | ||
}, | ||
sq: c, | ||
@@ -1357,13 +1379,21 @@ sr: c, | ||
// cruft than for ES module exports. | ||
const Plurals = plurals || P; | ||
const Categories = pluralCategories || C; | ||
const RangePlurals = ranges || R; | ||
var Plurals = plurals || P; | ||
var Categories = pluralCategories || C; | ||
var RangePlurals = ranges || R; | ||
// make-plural exports are cast with safe-identifier to be valid JS identifiers | ||
const id = lc => lc === 'pt-PT' ? 'pt_PT' : lc; | ||
const getSelector = lc => Plurals[id(lc)]; | ||
const getCategories = (lc, ord) => Categories[id(lc)][ord ? 'ordinal' : 'cardinal']; | ||
const getRangeSelector = lc => RangePlurals[id(lc)]; | ||
const PluralRules = getPluralRules__default["default"](Intl.NumberFormat, getSelector, getCategories, getRangeSelector); | ||
var id = function id(lc) { | ||
return lc === 'pt-PT' ? 'pt_PT' : lc; | ||
}; | ||
var getSelector = function getSelector(lc) { | ||
return Plurals[id(lc)]; | ||
}; | ||
var getCategories = function getCategories(lc, ord) { | ||
return Categories[id(lc)][ord ? 'ordinal' : 'cardinal']; | ||
}; | ||
var getRangeSelector = function getRangeSelector(lc) { | ||
return RangePlurals[id(lc)]; | ||
}; | ||
var PluralRules = getPluralRules__default["default"](Intl.NumberFormat, getSelector, getCategories, getRangeSelector); | ||
module.exports = PluralRules; |
@@ -28,4 +28,4 @@ 'use strict'; | ||
} else { | ||
const test = ['en', 'es', 'ru', 'zh']; | ||
const supported = Intl.PluralRules.supportedLocalesOf(test); | ||
var test = ['en', 'es', 'ru', 'zh']; | ||
var supported = Intl.PluralRules.supportedLocalesOf(test); | ||
if (supported.length < test.length) { | ||
@@ -32,0 +32,0 @@ Intl.PluralRules = PluralRules__default["default"]; |
Sorry, the diff of this file is not supported yet
65087
1863