Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@phensley/plurals

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phensley/plurals - npm Package Compare versions

Comparing version 0.23.0 to 0.24.0

lib-es/api.d.ts

7

lib-es/autogen.rules.d.ts

@@ -0,7 +1,8 @@

import { Expr, Rule } from './types';
export declare const cardinalRules: {
[x: string]: string;
[x: string]: Rule[];
};
export declare const ordinalRules: {
[x: string]: string;
[x: string]: Rule[];
};
export declare const expressions: string[];
export declare const expressions: Expr[];

@@ -5,438 +5,799 @@ //

export var cardinalRules = {
af: 'B|0_F|1',
ak: 'B|2_F|1',
am: 'B|3|0_F|1',
an: 'B|0_F|1',
ar: 'A|4_B|0_C|5_D|6_E|7_F|1',
ars: 'A|4_B|0_C|5_D|6_E|7_F|1',
as: 'B|3|0_F|1',
asa: 'B|0_F|1',
ast: 'B|8&9_F|1',
az: 'B|0_F|1',
be: 'B|10&11_D|12&13_E|14|15|16_F|1',
bem: 'B|0_F|1',
bez: 'B|0_F|1',
bg: 'B|0_F|1',
bho: 'B|2_F|1',
bm: 'F|1',
bn: 'B|3|0_F|1',
bo: 'F|1',
br: 'B|10&17_C|18&19_D|20&21_E|22&23_F|1',
brx: 'B|0_F|1',
bs: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1',
ca: 'B|8&9_F|1',
ce: 'B|0_F|1',
ceb: 'B|9&32|9&33|34&35_F|1',
cgg: 'B|0_F|1',
chr: 'B|0_F|1',
ckb: 'B|0_F|1',
cs: 'B|8&9_D|36&9_E|34_F|1',
cy: 'A|4_B|0_C|5_D|37_E|38_F|1',
da: 'B|0|39&40_F|1',
de: 'B|8&9_F|1',
dsb: 'B|9&41|42_C|9&43|44_D|9&45|46_F|1',
dv: 'B|0_F|1',
dz: 'F|1',
ee: 'B|0_F|1',
el: 'B|0_F|1',
en: 'B|8&9_F|1',
eo: 'B|0_F|1',
es: 'B|0_F|1',
et: 'B|8&9_F|1',
eu: 'B|0_F|1',
fa: 'B|3|0_F|1',
ff: 'B|40_F|1',
fi: 'B|8&9_F|1',
fil: 'B|9&32|9&33|34&35_F|1',
fo: 'B|0_F|1',
fr: 'B|40_F|1',
fur: 'B|0_F|1',
fy: 'B|8&9_F|1',
ga: 'B|0_C|5_D|47_E|48_F|1',
gd: 'B|49_C|50_D|51_F|1',
gl: 'B|8&9_F|1',
gsw: 'B|0_F|1',
gu: 'B|3|0_F|1',
guw: 'B|2_F|1',
gv: 'B|9&24_C|9&52_D|9&53_E|34_F|1',
ha: 'B|0_F|1',
haw: 'B|0_F|1',
he: 'B|8&9_C|54&9_E|9&55&14_F|1',
hi: 'B|3|0_F|1',
hr: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1',
hsb: 'B|9&41|42_C|9&43|44_D|9&45|46_F|1',
hu: 'B|0_F|1',
hy: 'B|40_F|1',
ia: 'B|8&9_F|1',
id: 'F|1',
ig: 'F|1',
ii: 'F|1',
in: 'F|1',
io: 'B|8&9_F|1',
is: 'B|56&24&25|39_F|1',
it: 'B|8&9_F|1',
iu: 'B|0_C|5_F|1',
iw: 'B|8&9_C|54&9_E|9&55&14_F|1',
ja: 'F|1',
jbo: 'F|1',
jgo: 'B|0_F|1',
ji: 'B|8&9_F|1',
jmc: 'B|0_F|1',
jv: 'F|1',
jw: 'F|1',
ka: 'B|0_F|1',
kab: 'B|40_F|1',
kaj: 'B|0_F|1',
kcg: 'B|0_F|1',
kde: 'F|1',
kea: 'F|1',
kk: 'B|0_F|1',
kkj: 'B|0_F|1',
kl: 'B|0_F|1',
km: 'F|1',
kn: 'B|3|0_F|1',
ko: 'F|1',
ks: 'B|0_F|1',
ksb: 'B|0_F|1',
ksh: 'A|4_B|0_F|1',
ku: 'B|0_F|1',
kw: 'A|4_B|0_C|57|58&59|22&60_D|61_E|62&63_F|1',
ky: 'B|0_F|1',
lag: 'A|4_B|40&22_F|1',
lb: 'B|0_F|1',
lg: 'B|0_F|1',
lkt: 'F|1',
ln: 'B|2_F|1',
lo: 'F|1',
lt: 'B|10&64_D|65&64_E|66_F|1',
lv: 'A|14|67|68&69_B|10&11|68&26&27|70&26_F|1',
mas: 'B|0_F|1',
mg: 'B|2_F|1',
mgo: 'B|0_F|1',
mk: 'B|9&24&25|26&27_F|1',
ml: 'B|0_F|1',
mn: 'B|0_F|1',
mo: 'B|8&9_D|34|4|71_F|1',
mr: 'B|0_F|1',
ms: 'F|1',
mt: 'B|0_D|4|72_E|67_F|1',
my: 'F|1',
nah: 'B|0_F|1',
naq: 'B|0_C|5_F|1',
nb: 'B|0_F|1',
nd: 'B|0_F|1',
ne: 'B|0_F|1',
nl: 'B|8&9_F|1',
nn: 'B|0_F|1',
nnh: 'B|0_F|1',
no: 'B|0_F|1',
nqo: 'F|1',
nr: 'B|0_F|1',
nso: 'B|2_F|1',
ny: 'B|0_F|1',
nyn: 'B|0_F|1',
om: 'B|0_F|1',
or: 'B|0_F|1',
os: 'B|0_F|1',
osa: 'F|1',
pa: 'B|2_F|1',
pap: 'B|0_F|1',
pl: 'B|8&9_D|9&28&29_E|9&73&74|9&75|9&76_F|1',
prg: 'A|14|67|68&69_B|10&11|68&26&27|70&26_F|1',
ps: 'B|0_F|1',
pt: 'B|77_F|1',
'pt-PT': 'B|8&9_F|1',
rm: 'B|0_F|1',
ro: 'B|8&9_D|34|4|71_F|1',
rof: 'B|0_F|1',
root: 'F|1',
ru: 'B|9&24&25_D|9&28&29_E|9&78|9&75|9&79_F|1',
rwk: 'B|0_F|1',
sah: 'F|1',
saq: 'B|0_F|1',
sc: 'B|8&9_F|1',
scn: 'B|8&9_F|1',
sd: 'B|0_F|1',
sdh: 'B|0_F|1',
se: 'B|0_C|5_F|1',
seh: 'B|0_F|1',
ses: 'F|1',
sg: 'F|1',
sh: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1',
shi: 'B|3|0_D|80_F|1',
si: 'B|81|3&82_F|1',
sk: 'B|8&9_D|36&9_E|34_F|1',
sl: 'B|9&41_C|9&43_D|9&45|34_F|1',
sma: 'B|0_C|5_F|1',
smi: 'B|0_C|5_F|1',
smj: 'B|0_C|5_F|1',
smn: 'B|0_C|5_F|1',
sms: 'B|0_C|5_F|1',
sn: 'B|0_F|1',
so: 'B|0_F|1',
sq: 'B|0_F|1',
sr: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1',
ss: 'B|0_F|1',
ssy: 'B|0_F|1',
st: 'B|0_F|1',
su: 'F|1',
sv: 'B|8&9_F|1',
sw: 'B|8&9_F|1',
syr: 'B|0_F|1',
ta: 'B|0_F|1',
te: 'B|0_F|1',
teo: 'B|0_F|1',
th: 'F|1',
ti: 'B|2_F|1',
tig: 'B|0_F|1',
tk: 'B|0_F|1',
tl: 'B|9&32|9&33|34&35_F|1',
tn: 'B|0_F|1',
to: 'F|1',
tr: 'B|0_F|1',
ts: 'B|0_F|1',
tzm: 'B|2|83_F|1',
ug: 'B|0_F|1',
uk: 'B|9&24&25_D|9&28&29_E|9&78|9&75|9&79_F|1',
ur: 'B|8&9_F|1',
uz: 'B|0_F|1',
ve: 'B|0_F|1',
vi: 'F|1',
vo: 'B|0_F|1',
vun: 'B|0_F|1',
wa: 'B|2_F|1',
wae: 'B|0_F|1',
wo: 'F|1',
xh: 'B|0_F|1',
xog: 'B|0_F|1',
yi: 'B|8&9_F|1',
yo: 'F|1',
yue: 'F|1',
zh: 'F|1',
zu: 'B|3|0_F|1'
af: [[1, [[0]]]],
ak: [[1, [[1]]]],
am: [[1, [[2], [0]]]],
an: [[1, [[0]]]],
ar: [
[0, [[3]]],
[1, [[0]]],
[2, [[4]]],
[3, [[5]]],
[4, [[6]]]
],
ars: [
[0, [[3]]],
[1, [[0]]],
[2, [[4]]],
[3, [[5]]],
[4, [[6]]]
],
as: [[1, [[2], [0]]]],
asa: [[1, [[0]]]],
ast: [[1, [[7, 8]]]],
az: [[1, [[0]]]],
be: [
[1, [[9, 10]]],
[3, [[11, 12]]],
[4, [[13], [14], [15]]]
],
bem: [[1, [[0]]]],
bez: [[1, [[0]]]],
bg: [[1, [[0]]]],
bho: [[1, [[1]]]],
bm: [],
bn: [[1, [[2], [0]]]],
bo: [],
br: [
[1, [[9, 16]]],
[2, [[17, 18]]],
[3, [[19, 20]]],
[4, [[21, 22]]]
],
brx: [[1, [[0]]]],
bs: [
[
1,
[
[8, 23, 24],
[25, 26]
]
],
[
3,
[
[8, 27, 28],
[29, 30]
]
]
],
ca: [[1, [[7, 8]]]],
ce: [[1, [[0]]]],
ceb: [
[
1,
[
[8, 31],
[8, 32],
[33, 34]
]
]
],
cgg: [[1, [[0]]]],
chr: [[1, [[0]]]],
ckb: [[1, [[0]]]],
cs: [
[1, [[7, 8]]],
[3, [[35, 8]]],
[4, [[33]]]
],
cy: [
[0, [[3]]],
[1, [[0]]],
[2, [[4]]],
[3, [[36]]],
[4, [[37]]]
],
da: [[1, [[0], [38, 39]]]],
de: [[1, [[7, 8]]]],
dsb: [
[1, [[8, 40], [41]]],
[2, [[8, 42], [43]]],
[3, [[8, 44], [45]]]
],
dv: [[1, [[0]]]],
dz: [],
ee: [[1, [[0]]]],
el: [[1, [[0]]]],
en: [[1, [[7, 8]]]],
eo: [[1, [[0]]]],
es: [[1, [[0]]]],
et: [[1, [[7, 8]]]],
eu: [[1, [[0]]]],
fa: [[1, [[2], [0]]]],
ff: [[1, [[39]]]],
fi: [[1, [[7, 8]]]],
fil: [
[
1,
[
[8, 31],
[8, 32],
[33, 34]
]
]
],
fo: [[1, [[0]]]],
fr: [[1, [[39]]]],
fur: [[1, [[0]]]],
fy: [[1, [[7, 8]]]],
ga: [
[1, [[0]]],
[2, [[4]]],
[3, [[46]]],
[4, [[47]]]
],
gd: [
[1, [[48]]],
[2, [[49]]],
[3, [[50]]]
],
gl: [[1, [[7, 8]]]],
gsw: [[1, [[0]]]],
gu: [[1, [[2], [0]]]],
guw: [[1, [[1]]]],
gv: [
[1, [[8, 23]]],
[2, [[8, 51]]],
[3, [[8, 52]]],
[4, [[33]]]
],
ha: [[1, [[0]]]],
haw: [[1, [[0]]]],
he: [
[1, [[7, 8]]],
[2, [[53, 8]]],
[4, [[8, 54, 13]]]
],
hi: [[1, [[2], [0]]]],
hr: [
[
1,
[
[8, 23, 24],
[25, 26]
]
],
[
3,
[
[8, 27, 28],
[29, 30]
]
]
],
hsb: [
[1, [[8, 40], [41]]],
[2, [[8, 42], [43]]],
[3, [[8, 44], [45]]]
],
hu: [[1, [[0]]]],
hy: [[1, [[39]]]],
ia: [[1, [[7, 8]]]],
id: [],
ig: [],
ii: [],
in: [],
io: [[1, [[7, 8]]]],
is: [[1, [[55, 23, 24], [38]]]],
it: [[1, [[7, 8]]]],
iu: [
[1, [[0]]],
[2, [[4]]]
],
iw: [
[1, [[7, 8]]],
[2, [[53, 8]]],
[4, [[8, 54, 13]]]
],
ja: [],
jbo: [],
jgo: [[1, [[0]]]],
ji: [[1, [[7, 8]]]],
jmc: [[1, [[0]]]],
jv: [],
jw: [],
ka: [[1, [[0]]]],
kab: [[1, [[39]]]],
kaj: [[1, [[0]]]],
kcg: [[1, [[0]]]],
kde: [],
kea: [],
kk: [[1, [[0]]]],
kkj: [[1, [[0]]]],
kl: [[1, [[0]]]],
km: [],
kn: [[1, [[2], [0]]]],
ko: [],
ks: [[1, [[0]]]],
ksb: [[1, [[0]]]],
ksh: [
[0, [[3]]],
[1, [[0]]]
],
ku: [[1, [[0]]]],
kw: [
[0, [[3]]],
[1, [[0]]],
[2, [[56], [57, 58], [21, 59]]],
[3, [[60]]],
[4, [[61, 62]]]
],
ky: [[1, [[0]]]],
lag: [
[0, [[3]]],
[1, [[39, 21]]]
],
lb: [[1, [[0]]]],
lg: [[1, [[0]]]],
lkt: [],
ln: [[1, [[1]]]],
lo: [],
lt: [
[1, [[9, 63]]],
[3, [[64, 63]]],
[4, [[65]]]
],
lv: [
[0, [[13], [66], [67, 68]]],
[
1,
[
[9, 10],
[67, 25, 26],
[69, 25]
]
]
],
mas: [[1, [[0]]]],
mg: [[1, [[1]]]],
mgo: [[1, [[0]]]],
mk: [
[
1,
[
[8, 23, 24],
[25, 26]
]
]
],
ml: [[1, [[0]]]],
mn: [[1, [[0]]]],
mo: [
[1, [[7, 8]]],
[3, [[33], [3], [70]]]
],
mr: [[1, [[0]]]],
ms: [],
mt: [
[1, [[0]]],
[3, [[3], [71]]],
[4, [[66]]]
],
my: [],
nah: [[1, [[0]]]],
naq: [
[1, [[0]]],
[2, [[4]]]
],
nb: [[1, [[0]]]],
nd: [[1, [[0]]]],
ne: [[1, [[0]]]],
nl: [[1, [[7, 8]]]],
nn: [[1, [[0]]]],
nnh: [[1, [[0]]]],
no: [[1, [[0]]]],
nqo: [],
nr: [[1, [[0]]]],
nso: [[1, [[1]]]],
ny: [[1, [[0]]]],
nyn: [[1, [[0]]]],
om: [[1, [[0]]]],
or: [[1, [[0]]]],
os: [[1, [[0]]]],
osa: [],
pa: [[1, [[1]]]],
pap: [[1, [[0]]]],
pl: [
[1, [[7, 8]]],
[3, [[8, 27, 28]]],
[
4,
[
[8, 72, 73],
[8, 74],
[8, 75]
]
]
],
prg: [
[0, [[13], [66], [67, 68]]],
[
1,
[
[9, 10],
[67, 25, 26],
[69, 25]
]
]
],
ps: [[1, [[0]]]],
pt: [[1, [[76]]]],
'pt-PT': [[1, [[7, 8]]]],
rm: [[1, [[0]]]],
ro: [
[1, [[7, 8]]],
[3, [[33], [3], [70]]]
],
rof: [[1, [[0]]]],
root: [],
ru: [
[1, [[8, 23, 24]]],
[3, [[8, 27, 28]]],
[
4,
[
[8, 77],
[8, 74],
[8, 78]
]
]
],
rwk: [[1, [[0]]]],
sah: [],
saq: [[1, [[0]]]],
sc: [[1, [[7, 8]]]],
scn: [[1, [[7, 8]]]],
sd: [[1, [[0]]]],
sdh: [[1, [[0]]]],
se: [
[1, [[0]]],
[2, [[4]]]
],
seh: [[1, [[0]]]],
ses: [],
sg: [],
sh: [
[
1,
[
[8, 23, 24],
[25, 26]
]
],
[
3,
[
[8, 27, 28],
[29, 30]
]
]
],
shi: [
[1, [[2], [0]]],
[3, [[79]]]
],
si: [[1, [[80], [2, 81]]]],
sk: [
[1, [[7, 8]]],
[3, [[35, 8]]],
[4, [[33]]]
],
sl: [
[1, [[8, 40]]],
[2, [[8, 42]]],
[3, [[8, 44], [33]]]
],
sma: [
[1, [[0]]],
[2, [[4]]]
],
smi: [
[1, [[0]]],
[2, [[4]]]
],
smj: [
[1, [[0]]],
[2, [[4]]]
],
smn: [
[1, [[0]]],
[2, [[4]]]
],
sms: [
[1, [[0]]],
[2, [[4]]]
],
sn: [[1, [[0]]]],
so: [[1, [[0]]]],
sq: [[1, [[0]]]],
sr: [
[
1,
[
[8, 23, 24],
[25, 26]
]
],
[
3,
[
[8, 27, 28],
[29, 30]
]
]
],
ss: [[1, [[0]]]],
ssy: [[1, [[0]]]],
st: [[1, [[0]]]],
su: [],
sv: [[1, [[7, 8]]]],
sw: [[1, [[7, 8]]]],
syr: [[1, [[0]]]],
ta: [[1, [[0]]]],
te: [[1, [[0]]]],
teo: [[1, [[0]]]],
th: [],
ti: [[1, [[1]]]],
tig: [[1, [[0]]]],
tk: [[1, [[0]]]],
tl: [
[
1,
[
[8, 31],
[8, 32],
[33, 34]
]
]
],
tn: [[1, [[0]]]],
to: [],
tr: [[1, [[0]]]],
ts: [[1, [[0]]]],
tzm: [[1, [[1], [82]]]],
ug: [[1, [[0]]]],
uk: [
[1, [[8, 23, 24]]],
[3, [[8, 27, 28]]],
[
4,
[
[8, 77],
[8, 74],
[8, 78]
]
]
],
ur: [[1, [[7, 8]]]],
uz: [[1, [[0]]]],
ve: [[1, [[0]]]],
vi: [],
vo: [[1, [[0]]]],
vun: [[1, [[0]]]],
wa: [[1, [[1]]]],
wae: [[1, [[0]]]],
wo: [],
xh: [[1, [[0]]]],
xog: [[1, [[0]]]],
yi: [[1, [[7, 8]]]],
yo: [],
yue: [],
zh: [],
zu: [[1, [[2], [0]]]]
};
export var ordinalRules = {
af: 'F|1',
am: 'F|1',
an: 'F|1',
ar: 'F|1',
as: 'B|84_C|85_D|86_E|38_F|1',
az: 'B|87|88_D|89|90_E|3|91|92_F|1',
be: 'D|93&94_F|1',
bg: 'F|1',
bn: 'B|84_C|85_D|86_E|38_F|1',
bs: 'F|1',
ca: 'B|95_C|5_D|86_F|1',
ce: 'F|1',
cs: 'F|1',
cy: 'A|96_B|0_C|5_D|97_E|98_F|1',
da: 'F|1',
de: 'F|1',
dsb: 'F|1',
el: 'F|1',
en: 'B|10&11_C|18&99_D|100&101_F|1',
es: 'F|1',
et: 'F|1',
eu: 'F|1',
fa: 'F|1',
fi: 'F|1',
fil: 'B|0_F|1',
fr: 'B|0_F|1',
fy: 'F|1',
ga: 'B|0_F|1',
gd: 'B|49_C|50_D|102_F|1',
gl: 'F|1',
gsw: 'F|1',
gu: 'B|0_C|85_D|86_E|38_F|1',
he: 'F|1',
hi: 'B|0_C|85_D|86_E|38_F|1',
hr: 'F|1',
hsb: 'F|1',
hu: 'B|103_F|1',
hy: 'B|0_F|1',
ia: 'F|1',
id: 'F|1',
in: 'F|1',
is: 'F|1',
it: 'E|104_F|1',
iw: 'F|1',
ja: 'F|1',
ka: 'B|8_E|3|105_F|1',
kk: 'E|106|107|14&22_F|1',
km: 'F|1',
kn: 'F|1',
ko: 'F|1',
kw: 'B|108|109_E|110|111_F|1',
ky: 'F|1',
lo: 'B|0_F|1',
lt: 'F|1',
lv: 'F|1',
mk: 'B|24&25_C|52&112_E|113&114_F|1',
ml: 'F|1',
mn: 'F|1',
mo: 'B|0_F|1',
mr: 'B|0_C|85_D|86_F|1',
ms: 'B|0_F|1',
my: 'F|1',
nb: 'F|1',
ne: 'B|108_F|1',
nl: 'F|1',
or: 'B|115_C|85_D|86_E|38_F|1',
pa: 'F|1',
pl: 'F|1',
prg: 'F|1',
ps: 'F|1',
pt: 'F|1',
ro: 'B|0_F|1',
root: 'F|1',
ru: 'F|1',
sc: 'E|104_F|1',
scn: 'E|104_F|1',
sd: 'F|1',
sh: 'F|1',
si: 'F|1',
sk: 'F|1',
sl: 'F|1',
sq: 'B|0_E|116&117_F|1',
sr: 'F|1',
sv: 'B|118&119_F|1',
sw: 'F|1',
ta: 'F|1',
te: 'F|1',
th: 'F|1',
tk: 'D|120|121_F|1',
tl: 'B|0_F|1',
tr: 'F|1',
uk: 'D|100&101_F|1',
ur: 'F|1',
uz: 'F|1',
vi: 'B|0_F|1',
yue: 'F|1',
zh: 'F|1',
zu: 'F|1'
af: [],
am: [],
an: [],
ar: [],
as: [
[1, [[83]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
az: [
[1, [[86], [87]]],
[3, [[88], [89]]],
[4, [[2], [90], [91]]]
],
be: [[3, [[92, 93]]]],
bg: [],
bn: [
[1, [[83]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
bs: [],
ca: [
[1, [[94]]],
[2, [[4]]],
[3, [[85]]]
],
ce: [],
cs: [],
cy: [
[0, [[95]]],
[1, [[0]]],
[2, [[4]]],
[3, [[96]]],
[4, [[97]]]
],
da: [],
de: [],
dsb: [],
el: [],
en: [
[1, [[9, 10]]],
[2, [[17, 98]]],
[3, [[99, 100]]]
],
es: [],
et: [],
eu: [],
fa: [],
fi: [],
fil: [[1, [[0]]]],
fr: [[1, [[0]]]],
fy: [],
ga: [[1, [[0]]]],
gd: [
[1, [[48]]],
[2, [[49]]],
[3, [[101]]]
],
gl: [],
gsw: [],
gu: [
[1, [[0]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
he: [],
hi: [
[1, [[0]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
hr: [],
hsb: [],
hu: [[1, [[102]]]],
hy: [[1, [[0]]]],
ia: [],
id: [],
in: [],
is: [],
it: [[4, [[103]]]],
iw: [],
ja: [],
ka: [
[1, [[7]]],
[4, [[2], [104]]]
],
kk: [[4, [[105], [106], [13, 21]]]],
km: [],
kn: [],
ko: [],
kw: [
[1, [[107], [108]]],
[4, [[109], [110]]]
],
ky: [],
lo: [[1, [[0]]]],
lt: [],
lv: [],
mk: [
[1, [[23, 24]]],
[2, [[51, 111]]],
[4, [[112, 113]]]
],
ml: [],
mn: [],
mo: [[1, [[0]]]],
mr: [
[1, [[0]]],
[2, [[84]]],
[3, [[85]]]
],
ms: [[1, [[0]]]],
my: [],
nb: [],
ne: [[1, [[107]]]],
nl: [],
or: [
[1, [[114]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
pa: [],
pl: [],
prg: [],
ps: [],
pt: [],
ro: [[1, [[0]]]],
root: [],
ru: [],
sc: [[4, [[103]]]],
scn: [[4, [[103]]]],
sd: [],
sh: [],
si: [],
sk: [],
sl: [],
sq: [
[1, [[0]]],
[4, [[115, 116]]]
],
sr: [],
sv: [[1, [[117, 118]]]],
sw: [],
ta: [],
te: [],
th: [],
tk: [[3, [[119], [120]]]],
tl: [[1, [[0]]]],
tr: [],
uk: [[3, [[99, 100]]]],
ur: [],
uz: [],
vi: [[1, [[0]]]],
yue: [],
zh: [],
zu: []
};
export var expressions = [
'n0:1',
'',
'n0:0:1',
'i0:0',
'n0:0',
'n0:2',
'n100:3:10',
'n100:11:99',
'i0:1',
'v0:0',
'n10:1',
'n100!:11',
'n10:2:4',
'n100!:12:14',
'n10:0',
'n10:5:9',
'n100:11:14',
'n100!:11,71,91',
'n10:2',
'n100!:12,72,92',
'n10:3:4,9',
'n100!:10:19,70:79,90:99',
'n0!:0',
'n1000000:0',
'i10:1',
'i100!:11',
'f10:1',
'f100!:11',
'i10:2:4',
'i100!:12:14',
'f10:2:4',
'f100!:12:14',
'i0:1,2,3',
'i10!:4,6,9',
'v0!:0',
'f10!:4,6,9',
'i0:2:4',
'n0:3',
'n0:6',
't0!:0',
'i0:0,1',
'i100:1',
'f100:1',
'i100:2',
'f100:2',
'i100:3:4',
'f100:3:4',
'n0:3:6',
'n0:7:10',
'n0:1,11',
'n0:2,12',
'n0:3:10,13:19',
'i10:2',
'i100:0,20,40,60,80',
'i0:2',
'n0!:0:10',
't0:0',
'n100:2,22,42,62,82',
'n1000:0',
'n100000:1000:20000,40000,60000,80000',
'n1000000:100000',
'n100:3,23,43,63,83',
'n0!:1',
'n100:1,21,41,61,81',
'n100!:11:19',
'n10:2:9',
'f0!:0',
'n100:11:19',
'v0:2',
'f100:11:19',
'v0!:2',
'n100:2:19',
'n100:2:10',
'i0!:1',
'i10:0:1',
'i10:5:9',
'i100:12:14',
'i0:0:1',
'i10:0',
'i100:11:14',
'n0:2:10',
'n0:0,1',
'f0:1',
'n0:11:99',
'n0:1,5,7,8,9,10',
'n0:2,3',
'n0:4',
'i10:1,2,5,7,8',
'i100:20,50,70,80',
'i10:3,4',
'i1000:100,200,300,400,500,600,700,800,900',
'i10:6',
'i100:40,60,90',
'n10:2,3',
'n100!:12,13',
'n0:1,3',
'n0:0,7,8,9',
'n0:3,4',
'n0:5,6',
'n100!:12',
'n10:3',
'n100!:13',
'n0:3,13',
'n0:1,5',
'n0:11,8,80,800',
'i100:2:20,40,60,80',
'n10:6',
'n10:9',
'n0:1:4',
'n100:1:4,21:24,41:44,61:64,81:84',
'n0:5',
'n100:5',
'i100!:12',
'i10:7,8',
'i100!:17,18',
'n0:1,5,7:9',
'n10:4',
'n100!:14',
'n10:1,2',
'n100!:11,12',
'n10:6,9',
'n0:10'
['n', 0, 1, [1]],
['n', 0, 1, [[0, 1]]],
['i', 0, 1, [0]],
['n', 0, 1, [0]],
['n', 0, 1, [2]],
['n', 100, 1, [[3, 10]]],
['n', 100, 1, [[11, 99]]],
['i', 0, 1, [1]],
['v', 0, 1, [0]],
['n', 10, 1, [1]],
['n', 100, 0, [11]],
['n', 10, 1, [[2, 4]]],
['n', 100, 0, [[12, 14]]],
['n', 10, 1, [0]],
['n', 10, 1, [[5, 9]]],
['n', 100, 1, [[11, 14]]],
['n', 100, 0, [11, 71, 91]],
['n', 10, 1, [2]],
['n', 100, 0, [12, 72, 92]],
['n', 10, 1, [[3, 4], 9]],
[
'n',
100,
0,
[
[10, 19],
[70, 79],
[90, 99]
]
],
['n', 0, 0, [0]],
['n', 1000000, 1, [0]],
['i', 10, 1, [1]],
['i', 100, 0, [11]],
['f', 10, 1, [1]],
['f', 100, 0, [11]],
['i', 10, 1, [[2, 4]]],
['i', 100, 0, [[12, 14]]],
['f', 10, 1, [[2, 4]]],
['f', 100, 0, [[12, 14]]],
['i', 0, 1, [1, 2, 3]],
['i', 10, 0, [4, 6, 9]],
['v', 0, 0, [0]],
['f', 10, 0, [4, 6, 9]],
['i', 0, 1, [[2, 4]]],
['n', 0, 1, [3]],
['n', 0, 1, [6]],
['t', 0, 0, [0]],
['i', 0, 1, [0, 1]],
['i', 100, 1, [1]],
['f', 100, 1, [1]],
['i', 100, 1, [2]],
['f', 100, 1, [2]],
['i', 100, 1, [[3, 4]]],
['f', 100, 1, [[3, 4]]],
['n', 0, 1, [[3, 6]]],
['n', 0, 1, [[7, 10]]],
['n', 0, 1, [1, 11]],
['n', 0, 1, [2, 12]],
[
'n',
0,
1,
[
[3, 10],
[13, 19]
]
],
['i', 10, 1, [2]],
['i', 100, 1, [0, 20, 40, 60, 80]],
['i', 0, 1, [2]],
['n', 0, 0, [[0, 10]]],
['t', 0, 1, [0]],
['n', 100, 1, [2, 22, 42, 62, 82]],
['n', 1000, 1, [0]],
['n', 100000, 1, [[1000, 20000], 40000, 60000, 80000]],
['n', 1000000, 1, [100000]],
['n', 100, 1, [3, 23, 43, 63, 83]],
['n', 0, 0, [1]],
['n', 100, 1, [1, 21, 41, 61, 81]],
['n', 100, 0, [[11, 19]]],
['n', 10, 1, [[2, 9]]],
['f', 0, 0, [0]],
['n', 100, 1, [[11, 19]]],
['v', 0, 1, [2]],
['f', 100, 1, [[11, 19]]],
['v', 0, 0, [2]],
['n', 100, 1, [[2, 19]]],
['n', 100, 1, [[2, 10]]],
['i', 0, 0, [1]],
['i', 10, 1, [[0, 1]]],
['i', 10, 1, [[5, 9]]],
['i', 100, 1, [[12, 14]]],
['i', 0, 1, [[0, 1]]],
['i', 10, 1, [0]],
['i', 100, 1, [[11, 14]]],
['n', 0, 1, [[2, 10]]],
['n', 0, 1, [0, 1]],
['f', 0, 1, [1]],
['n', 0, 1, [[11, 99]]],
['n', 0, 1, [1, 5, 7, 8, 9, 10]],
['n', 0, 1, [2, 3]],
['n', 0, 1, [4]],
['i', 10, 1, [1, 2, 5, 7, 8]],
['i', 100, 1, [20, 50, 70, 80]],
['i', 10, 1, [3, 4]],
['i', 1000, 1, [100, 200, 300, 400, 500, 600, 700, 800, 900]],
['i', 10, 1, [6]],
['i', 100, 1, [40, 60, 90]],
['n', 10, 1, [2, 3]],
['n', 100, 0, [12, 13]],
['n', 0, 1, [1, 3]],
['n', 0, 1, [0, 7, 8, 9]],
['n', 0, 1, [3, 4]],
['n', 0, 1, [5, 6]],
['n', 100, 0, [12]],
['n', 10, 1, [3]],
['n', 100, 0, [13]],
['n', 0, 1, [3, 13]],
['n', 0, 1, [1, 5]],
['n', 0, 1, [11, 8, 80, 800]],
['i', 100, 1, [[2, 20], 40, 60, 80]],
['n', 10, 1, [6]],
['n', 10, 1, [9]],
['n', 0, 1, [[1, 4]]],
[
'n',
100,
1,
[
[1, 4],
[21, 24],
[41, 44],
[61, 64],
[81, 84]
]
],
['n', 0, 1, [5]],
['n', 100, 1, [5]],
['i', 100, 0, [12]],
['i', 10, 1, [7, 8]],
['i', 100, 0, [17, 18]],
['n', 0, 1, [1, 5, [7, 9]]],
['n', 10, 1, [4]],
['n', 100, 0, [14]],
['n', 10, 1, [1, 2]],
['n', 100, 0, [11, 12]],
['n', 10, 1, [6, 9]],
['n', 0, 1, [10]]
];
//# sourceMappingURL=autogen.rules.js.map

@@ -0,3 +1,3 @@

export { pluralRules, Plurals } from './api';
export { NumberOperands } from './operands';
import { PluralRules } from './types';
export declare const pluralRules: PluralRules;
export { PluralRules } from './rules';

@@ -1,5 +0,4 @@

import { cardinalRules, expressions, ordinalRules } from './autogen.rules';
export { pluralRules, Plurals } from './api';
export { NumberOperands } from './operands';
import { PluralRules } from './types';
export var pluralRules = new PluralRules(expressions, cardinalRules, ordinalRules);
export { PluralRules } from './rules';
//# sourceMappingURL=index.js.map
import { Decimal } from '@phensley/decimal';
export declare type Operand = 'n' | 'i' | 'v' | 'w' | 'f' | 't';
/**

@@ -3,0 +4,0 @@ * Operands for use in evaluating localized plural rules:

@@ -1,67 +0,20 @@

import { Decimal, DecimalArg } from '@phensley/decimal';
import { NumberOperands } from './operands';
export declare type RuleMap = {
[x: string]: PluralRule;
};
export declare type StringMap = {
[x: string]: string;
};
export declare type Operand = 'n' | 'i' | 'v' | 'w' | 'f' | 't';
export declare const enum Op {
N = 0,
I = 1,
V = 2,
W = 4,
F = 8,
T = 16
export declare type RangeList = Array<number | Range>;
export interface Range {
[0]: number;
[1]: number;
}
export declare class RuleCache {
private strings;
private rules;
constructor(strings: StringMap);
get(language: string): PluralRule | undefined;
export interface Expr {
[0]: string;
[1]: number;
[2]: number;
[3]: RangeList;
}
/**
* Set of all cardinal and ordinal plural rules, and the array of expression
* fragments the rules reference.
*/
export declare class PluralRules {
private expressionsRaw;
private expressions;
private cardinals;
private ordinals;
constructor(expressionsRaw: string[], cardinalsRaw: StringMap, ordinalsRaw: StringMap);
operands(d: Decimal): NumberOperands;
cardinal(language: string, n: DecimalArg): string;
ordinal(language: string, n: DecimalArg): string;
private evaluate;
private execute;
private getExpression;
export declare type AndCond = Array<Expr>;
export declare type OrCond = Array<AndCond>;
export interface Rule {
[0]: number;
[1]: number[][];
}
/**
* Parses a packed plural rule, consisting of plural categories and the
* expressions.
*/
export declare class PluralRule {
readonly conditions: PluralCond[];
constructor(raw: string);
}
/**
* Parse a packed plural condition for a single category.
*/
export declare class PluralCond {
readonly category: string;
readonly conditions: number[][];
constructor(raw: string);
}
/**
* Parses a packed plural expression.
*/
export declare class PluralExpr {
readonly operand: Operand;
readonly operator: string;
readonly mod?: number;
readonly ranges: (number | number[])[];
constructor(raw: string);
}
export declare const evaluateExpr: (operands: NumberOperands, expr: PluralExpr) => boolean;
export declare type RuleMap = {
[x: string]: Rule[];
};

@@ -1,198 +0,1 @@

import { coerceDecimal } from '@phensley/decimal';
import { NumberOperands } from './operands';
// Notation for categories in compact plural rules
var CATEGORIES = {
'A': 'zero',
'B': 'one',
'C': 'two',
'D': 'few',
'E': 'many',
'F': 'other'
};
var RuleCache = /** @class */ (function () {
function RuleCache(strings) {
this.strings = strings;
this.rules = {};
}
RuleCache.prototype.get = function (language) {
var rule = this.rules[language];
if (rule === undefined) {
var raw = this.strings[language];
if (raw === undefined) {
return;
}
rule = new PluralRule(raw);
this.rules[language] = rule;
}
return rule;
};
return RuleCache;
}());
export { RuleCache };
/**
* Set of all cardinal and ordinal plural rules, and the array of expression
* fragments the rules reference.
*/
var PluralRules = /** @class */ (function () {
function PluralRules(expressionsRaw, cardinalsRaw, ordinalsRaw) {
this.expressionsRaw = expressionsRaw;
this.expressions = new Array(expressionsRaw.length);
this.cardinals = new RuleCache(cardinalsRaw);
this.ordinals = new RuleCache(ordinalsRaw);
}
PluralRules.prototype.operands = function (d) {
return new NumberOperands(d);
};
PluralRules.prototype.cardinal = function (language, n) {
return this.evaluate(language, new NumberOperands(coerceDecimal(n)), this.cardinals);
};
PluralRules.prototype.ordinal = function (language, n) {
return this.evaluate(language, new NumberOperands(coerceDecimal(n)), this.ordinals);
};
PluralRules.prototype.evaluate = function (language, operands, cache) {
var rule = cache.get(language);
if (rule === undefined) {
rule = cache.get('root');
}
if (rule !== undefined) {
for (var _i = 0, _a = rule.conditions; _i < _a.length; _i++) {
var cond = _a[_i];
if (this.execute(operands, cond.conditions)) {
return cond.category;
}
}
}
return 'other';
};
PluralRules.prototype.execute = function (operands, conditions) {
// Evaluate each condition and OR them together.
var len = conditions.length;
for (var i = 0; i < len; i++) {
var cond = conditions[i];
// Evaluate the inner expressions and AND them together.
var res = true;
for (var j = 0; j < cond.length; j++) {
var expr = this.getExpression(cond[j]);
res = res && evaluateExpr(operands, expr);
if (!res) {
break;
}
}
if (res) {
return true;
}
}
return false;
};
PluralRules.prototype.getExpression = function (id) {
var expr = this.expressions[id];
if (expr === undefined) {
var raw = this.expressionsRaw[id];
expr = new PluralExpr(raw);
this.expressions[id] = expr;
}
return expr;
};
return PluralRules;
}());
export { PluralRules };
/**
* Parses a packed plural rule, consisting of plural categories and the
* expressions.
*/
var PluralRule = /** @class */ (function () {
function PluralRule(raw) {
this.conditions = raw.split('_').map(function (s) { return new PluralCond(s); });
}
return PluralRule;
}());
export { PluralRule };
/**
* Parse a packed plural condition for a single category.
*/
var PluralCond = /** @class */ (function () {
function PluralCond(raw) {
var parts = raw.split('|');
this.category = CATEGORIES[parts[0]];
this.conditions = parts.slice(1).map(function (o) { return o.split('&').map(Number); });
}
return PluralCond;
}());
export { PluralCond };
/**
* Parses a packed plural expression.
*/
var PluralExpr = /** @class */ (function () {
function PluralExpr(raw) {
this.operand = raw[0];
var done = false;
this.operator = '=';
var mod = 0;
var i = 1;
while (i < raw.length) {
var ch = raw[i];
switch (ch) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
mod *= 10;
mod += Number(ch);
break;
case '!':
this.operator = '!';
break;
case ':':
i++;
done = true;
break;
}
if (done) {
break;
}
i++;
}
if (mod) {
this.mod = mod;
}
raw = raw.substring(i);
this.ranges = raw ? raw.split(',')
.map(function (s) { return s.indexOf(':') === -1 ? Number(s) : s.split(':').map(function (x) { return Number(x); }); }) : [];
}
return PluralExpr;
}());
export { PluralExpr };
export var evaluateExpr = function (operands, expr) {
var operand = expr.operand, ranges = expr.ranges;
if (!operand) {
return false;
}
var n = operands[operand];
// The N = X..Y syntax means N matches an integer from X to Y inclusive
// Operand 'n' must always be compared as an integer, so if it has any non-zero decimal
// parts we must set integer = false.
var integer = operand === 'n' ? operands.w === 0 : true;
if (expr.mod) {
n = n % expr.mod;
}
var equals = expr.operator !== '!';
var len = ranges.length;
var res = false;
for (var i = 0; i < len; i++) {
var elem = ranges[i];
if (typeof elem === 'number') {
res = res || (integer && n === elem);
}
else {
res = res || (integer && elem[0] <= n && n <= elem[1]);
}
}
return equals ? res : !res;
};
//# sourceMappingURL=types.js.map

@@ -0,7 +1,8 @@

import { Expr, Rule } from './types';
export declare const cardinalRules: {
[x: string]: string;
[x: string]: Rule[];
};
export declare const ordinalRules: {
[x: string]: string;
[x: string]: Rule[];
};
export declare const expressions: string[];
export declare const expressions: Expr[];

@@ -7,438 +7,799 @@ "use strict";

exports.cardinalRules = {
af: 'B|0_F|1',
ak: 'B|2_F|1',
am: 'B|3|0_F|1',
an: 'B|0_F|1',
ar: 'A|4_B|0_C|5_D|6_E|7_F|1',
ars: 'A|4_B|0_C|5_D|6_E|7_F|1',
as: 'B|3|0_F|1',
asa: 'B|0_F|1',
ast: 'B|8&9_F|1',
az: 'B|0_F|1',
be: 'B|10&11_D|12&13_E|14|15|16_F|1',
bem: 'B|0_F|1',
bez: 'B|0_F|1',
bg: 'B|0_F|1',
bho: 'B|2_F|1',
bm: 'F|1',
bn: 'B|3|0_F|1',
bo: 'F|1',
br: 'B|10&17_C|18&19_D|20&21_E|22&23_F|1',
brx: 'B|0_F|1',
bs: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1',
ca: 'B|8&9_F|1',
ce: 'B|0_F|1',
ceb: 'B|9&32|9&33|34&35_F|1',
cgg: 'B|0_F|1',
chr: 'B|0_F|1',
ckb: 'B|0_F|1',
cs: 'B|8&9_D|36&9_E|34_F|1',
cy: 'A|4_B|0_C|5_D|37_E|38_F|1',
da: 'B|0|39&40_F|1',
de: 'B|8&9_F|1',
dsb: 'B|9&41|42_C|9&43|44_D|9&45|46_F|1',
dv: 'B|0_F|1',
dz: 'F|1',
ee: 'B|0_F|1',
el: 'B|0_F|1',
en: 'B|8&9_F|1',
eo: 'B|0_F|1',
es: 'B|0_F|1',
et: 'B|8&9_F|1',
eu: 'B|0_F|1',
fa: 'B|3|0_F|1',
ff: 'B|40_F|1',
fi: 'B|8&9_F|1',
fil: 'B|9&32|9&33|34&35_F|1',
fo: 'B|0_F|1',
fr: 'B|40_F|1',
fur: 'B|0_F|1',
fy: 'B|8&9_F|1',
ga: 'B|0_C|5_D|47_E|48_F|1',
gd: 'B|49_C|50_D|51_F|1',
gl: 'B|8&9_F|1',
gsw: 'B|0_F|1',
gu: 'B|3|0_F|1',
guw: 'B|2_F|1',
gv: 'B|9&24_C|9&52_D|9&53_E|34_F|1',
ha: 'B|0_F|1',
haw: 'B|0_F|1',
he: 'B|8&9_C|54&9_E|9&55&14_F|1',
hi: 'B|3|0_F|1',
hr: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1',
hsb: 'B|9&41|42_C|9&43|44_D|9&45|46_F|1',
hu: 'B|0_F|1',
hy: 'B|40_F|1',
ia: 'B|8&9_F|1',
id: 'F|1',
ig: 'F|1',
ii: 'F|1',
in: 'F|1',
io: 'B|8&9_F|1',
is: 'B|56&24&25|39_F|1',
it: 'B|8&9_F|1',
iu: 'B|0_C|5_F|1',
iw: 'B|8&9_C|54&9_E|9&55&14_F|1',
ja: 'F|1',
jbo: 'F|1',
jgo: 'B|0_F|1',
ji: 'B|8&9_F|1',
jmc: 'B|0_F|1',
jv: 'F|1',
jw: 'F|1',
ka: 'B|0_F|1',
kab: 'B|40_F|1',
kaj: 'B|0_F|1',
kcg: 'B|0_F|1',
kde: 'F|1',
kea: 'F|1',
kk: 'B|0_F|1',
kkj: 'B|0_F|1',
kl: 'B|0_F|1',
km: 'F|1',
kn: 'B|3|0_F|1',
ko: 'F|1',
ks: 'B|0_F|1',
ksb: 'B|0_F|1',
ksh: 'A|4_B|0_F|1',
ku: 'B|0_F|1',
kw: 'A|4_B|0_C|57|58&59|22&60_D|61_E|62&63_F|1',
ky: 'B|0_F|1',
lag: 'A|4_B|40&22_F|1',
lb: 'B|0_F|1',
lg: 'B|0_F|1',
lkt: 'F|1',
ln: 'B|2_F|1',
lo: 'F|1',
lt: 'B|10&64_D|65&64_E|66_F|1',
lv: 'A|14|67|68&69_B|10&11|68&26&27|70&26_F|1',
mas: 'B|0_F|1',
mg: 'B|2_F|1',
mgo: 'B|0_F|1',
mk: 'B|9&24&25|26&27_F|1',
ml: 'B|0_F|1',
mn: 'B|0_F|1',
mo: 'B|8&9_D|34|4|71_F|1',
mr: 'B|0_F|1',
ms: 'F|1',
mt: 'B|0_D|4|72_E|67_F|1',
my: 'F|1',
nah: 'B|0_F|1',
naq: 'B|0_C|5_F|1',
nb: 'B|0_F|1',
nd: 'B|0_F|1',
ne: 'B|0_F|1',
nl: 'B|8&9_F|1',
nn: 'B|0_F|1',
nnh: 'B|0_F|1',
no: 'B|0_F|1',
nqo: 'F|1',
nr: 'B|0_F|1',
nso: 'B|2_F|1',
ny: 'B|0_F|1',
nyn: 'B|0_F|1',
om: 'B|0_F|1',
or: 'B|0_F|1',
os: 'B|0_F|1',
osa: 'F|1',
pa: 'B|2_F|1',
pap: 'B|0_F|1',
pl: 'B|8&9_D|9&28&29_E|9&73&74|9&75|9&76_F|1',
prg: 'A|14|67|68&69_B|10&11|68&26&27|70&26_F|1',
ps: 'B|0_F|1',
pt: 'B|77_F|1',
'pt-PT': 'B|8&9_F|1',
rm: 'B|0_F|1',
ro: 'B|8&9_D|34|4|71_F|1',
rof: 'B|0_F|1',
root: 'F|1',
ru: 'B|9&24&25_D|9&28&29_E|9&78|9&75|9&79_F|1',
rwk: 'B|0_F|1',
sah: 'F|1',
saq: 'B|0_F|1',
sc: 'B|8&9_F|1',
scn: 'B|8&9_F|1',
sd: 'B|0_F|1',
sdh: 'B|0_F|1',
se: 'B|0_C|5_F|1',
seh: 'B|0_F|1',
ses: 'F|1',
sg: 'F|1',
sh: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1',
shi: 'B|3|0_D|80_F|1',
si: 'B|81|3&82_F|1',
sk: 'B|8&9_D|36&9_E|34_F|1',
sl: 'B|9&41_C|9&43_D|9&45|34_F|1',
sma: 'B|0_C|5_F|1',
smi: 'B|0_C|5_F|1',
smj: 'B|0_C|5_F|1',
smn: 'B|0_C|5_F|1',
sms: 'B|0_C|5_F|1',
sn: 'B|0_F|1',
so: 'B|0_F|1',
sq: 'B|0_F|1',
sr: 'B|9&24&25|26&27_D|9&28&29|30&31_F|1',
ss: 'B|0_F|1',
ssy: 'B|0_F|1',
st: 'B|0_F|1',
su: 'F|1',
sv: 'B|8&9_F|1',
sw: 'B|8&9_F|1',
syr: 'B|0_F|1',
ta: 'B|0_F|1',
te: 'B|0_F|1',
teo: 'B|0_F|1',
th: 'F|1',
ti: 'B|2_F|1',
tig: 'B|0_F|1',
tk: 'B|0_F|1',
tl: 'B|9&32|9&33|34&35_F|1',
tn: 'B|0_F|1',
to: 'F|1',
tr: 'B|0_F|1',
ts: 'B|0_F|1',
tzm: 'B|2|83_F|1',
ug: 'B|0_F|1',
uk: 'B|9&24&25_D|9&28&29_E|9&78|9&75|9&79_F|1',
ur: 'B|8&9_F|1',
uz: 'B|0_F|1',
ve: 'B|0_F|1',
vi: 'F|1',
vo: 'B|0_F|1',
vun: 'B|0_F|1',
wa: 'B|2_F|1',
wae: 'B|0_F|1',
wo: 'F|1',
xh: 'B|0_F|1',
xog: 'B|0_F|1',
yi: 'B|8&9_F|1',
yo: 'F|1',
yue: 'F|1',
zh: 'F|1',
zu: 'B|3|0_F|1'
af: [[1, [[0]]]],
ak: [[1, [[1]]]],
am: [[1, [[2], [0]]]],
an: [[1, [[0]]]],
ar: [
[0, [[3]]],
[1, [[0]]],
[2, [[4]]],
[3, [[5]]],
[4, [[6]]]
],
ars: [
[0, [[3]]],
[1, [[0]]],
[2, [[4]]],
[3, [[5]]],
[4, [[6]]]
],
as: [[1, [[2], [0]]]],
asa: [[1, [[0]]]],
ast: [[1, [[7, 8]]]],
az: [[1, [[0]]]],
be: [
[1, [[9, 10]]],
[3, [[11, 12]]],
[4, [[13], [14], [15]]]
],
bem: [[1, [[0]]]],
bez: [[1, [[0]]]],
bg: [[1, [[0]]]],
bho: [[1, [[1]]]],
bm: [],
bn: [[1, [[2], [0]]]],
bo: [],
br: [
[1, [[9, 16]]],
[2, [[17, 18]]],
[3, [[19, 20]]],
[4, [[21, 22]]]
],
brx: [[1, [[0]]]],
bs: [
[
1,
[
[8, 23, 24],
[25, 26]
]
],
[
3,
[
[8, 27, 28],
[29, 30]
]
]
],
ca: [[1, [[7, 8]]]],
ce: [[1, [[0]]]],
ceb: [
[
1,
[
[8, 31],
[8, 32],
[33, 34]
]
]
],
cgg: [[1, [[0]]]],
chr: [[1, [[0]]]],
ckb: [[1, [[0]]]],
cs: [
[1, [[7, 8]]],
[3, [[35, 8]]],
[4, [[33]]]
],
cy: [
[0, [[3]]],
[1, [[0]]],
[2, [[4]]],
[3, [[36]]],
[4, [[37]]]
],
da: [[1, [[0], [38, 39]]]],
de: [[1, [[7, 8]]]],
dsb: [
[1, [[8, 40], [41]]],
[2, [[8, 42], [43]]],
[3, [[8, 44], [45]]]
],
dv: [[1, [[0]]]],
dz: [],
ee: [[1, [[0]]]],
el: [[1, [[0]]]],
en: [[1, [[7, 8]]]],
eo: [[1, [[0]]]],
es: [[1, [[0]]]],
et: [[1, [[7, 8]]]],
eu: [[1, [[0]]]],
fa: [[1, [[2], [0]]]],
ff: [[1, [[39]]]],
fi: [[1, [[7, 8]]]],
fil: [
[
1,
[
[8, 31],
[8, 32],
[33, 34]
]
]
],
fo: [[1, [[0]]]],
fr: [[1, [[39]]]],
fur: [[1, [[0]]]],
fy: [[1, [[7, 8]]]],
ga: [
[1, [[0]]],
[2, [[4]]],
[3, [[46]]],
[4, [[47]]]
],
gd: [
[1, [[48]]],
[2, [[49]]],
[3, [[50]]]
],
gl: [[1, [[7, 8]]]],
gsw: [[1, [[0]]]],
gu: [[1, [[2], [0]]]],
guw: [[1, [[1]]]],
gv: [
[1, [[8, 23]]],
[2, [[8, 51]]],
[3, [[8, 52]]],
[4, [[33]]]
],
ha: [[1, [[0]]]],
haw: [[1, [[0]]]],
he: [
[1, [[7, 8]]],
[2, [[53, 8]]],
[4, [[8, 54, 13]]]
],
hi: [[1, [[2], [0]]]],
hr: [
[
1,
[
[8, 23, 24],
[25, 26]
]
],
[
3,
[
[8, 27, 28],
[29, 30]
]
]
],
hsb: [
[1, [[8, 40], [41]]],
[2, [[8, 42], [43]]],
[3, [[8, 44], [45]]]
],
hu: [[1, [[0]]]],
hy: [[1, [[39]]]],
ia: [[1, [[7, 8]]]],
id: [],
ig: [],
ii: [],
in: [],
io: [[1, [[7, 8]]]],
is: [[1, [[55, 23, 24], [38]]]],
it: [[1, [[7, 8]]]],
iu: [
[1, [[0]]],
[2, [[4]]]
],
iw: [
[1, [[7, 8]]],
[2, [[53, 8]]],
[4, [[8, 54, 13]]]
],
ja: [],
jbo: [],
jgo: [[1, [[0]]]],
ji: [[1, [[7, 8]]]],
jmc: [[1, [[0]]]],
jv: [],
jw: [],
ka: [[1, [[0]]]],
kab: [[1, [[39]]]],
kaj: [[1, [[0]]]],
kcg: [[1, [[0]]]],
kde: [],
kea: [],
kk: [[1, [[0]]]],
kkj: [[1, [[0]]]],
kl: [[1, [[0]]]],
km: [],
kn: [[1, [[2], [0]]]],
ko: [],
ks: [[1, [[0]]]],
ksb: [[1, [[0]]]],
ksh: [
[0, [[3]]],
[1, [[0]]]
],
ku: [[1, [[0]]]],
kw: [
[0, [[3]]],
[1, [[0]]],
[2, [[56], [57, 58], [21, 59]]],
[3, [[60]]],
[4, [[61, 62]]]
],
ky: [[1, [[0]]]],
lag: [
[0, [[3]]],
[1, [[39, 21]]]
],
lb: [[1, [[0]]]],
lg: [[1, [[0]]]],
lkt: [],
ln: [[1, [[1]]]],
lo: [],
lt: [
[1, [[9, 63]]],
[3, [[64, 63]]],
[4, [[65]]]
],
lv: [
[0, [[13], [66], [67, 68]]],
[
1,
[
[9, 10],
[67, 25, 26],
[69, 25]
]
]
],
mas: [[1, [[0]]]],
mg: [[1, [[1]]]],
mgo: [[1, [[0]]]],
mk: [
[
1,
[
[8, 23, 24],
[25, 26]
]
]
],
ml: [[1, [[0]]]],
mn: [[1, [[0]]]],
mo: [
[1, [[7, 8]]],
[3, [[33], [3], [70]]]
],
mr: [[1, [[0]]]],
ms: [],
mt: [
[1, [[0]]],
[3, [[3], [71]]],
[4, [[66]]]
],
my: [],
nah: [[1, [[0]]]],
naq: [
[1, [[0]]],
[2, [[4]]]
],
nb: [[1, [[0]]]],
nd: [[1, [[0]]]],
ne: [[1, [[0]]]],
nl: [[1, [[7, 8]]]],
nn: [[1, [[0]]]],
nnh: [[1, [[0]]]],
no: [[1, [[0]]]],
nqo: [],
nr: [[1, [[0]]]],
nso: [[1, [[1]]]],
ny: [[1, [[0]]]],
nyn: [[1, [[0]]]],
om: [[1, [[0]]]],
or: [[1, [[0]]]],
os: [[1, [[0]]]],
osa: [],
pa: [[1, [[1]]]],
pap: [[1, [[0]]]],
pl: [
[1, [[7, 8]]],
[3, [[8, 27, 28]]],
[
4,
[
[8, 72, 73],
[8, 74],
[8, 75]
]
]
],
prg: [
[0, [[13], [66], [67, 68]]],
[
1,
[
[9, 10],
[67, 25, 26],
[69, 25]
]
]
],
ps: [[1, [[0]]]],
pt: [[1, [[76]]]],
'pt-PT': [[1, [[7, 8]]]],
rm: [[1, [[0]]]],
ro: [
[1, [[7, 8]]],
[3, [[33], [3], [70]]]
],
rof: [[1, [[0]]]],
root: [],
ru: [
[1, [[8, 23, 24]]],
[3, [[8, 27, 28]]],
[
4,
[
[8, 77],
[8, 74],
[8, 78]
]
]
],
rwk: [[1, [[0]]]],
sah: [],
saq: [[1, [[0]]]],
sc: [[1, [[7, 8]]]],
scn: [[1, [[7, 8]]]],
sd: [[1, [[0]]]],
sdh: [[1, [[0]]]],
se: [
[1, [[0]]],
[2, [[4]]]
],
seh: [[1, [[0]]]],
ses: [],
sg: [],
sh: [
[
1,
[
[8, 23, 24],
[25, 26]
]
],
[
3,
[
[8, 27, 28],
[29, 30]
]
]
],
shi: [
[1, [[2], [0]]],
[3, [[79]]]
],
si: [[1, [[80], [2, 81]]]],
sk: [
[1, [[7, 8]]],
[3, [[35, 8]]],
[4, [[33]]]
],
sl: [
[1, [[8, 40]]],
[2, [[8, 42]]],
[3, [[8, 44], [33]]]
],
sma: [
[1, [[0]]],
[2, [[4]]]
],
smi: [
[1, [[0]]],
[2, [[4]]]
],
smj: [
[1, [[0]]],
[2, [[4]]]
],
smn: [
[1, [[0]]],
[2, [[4]]]
],
sms: [
[1, [[0]]],
[2, [[4]]]
],
sn: [[1, [[0]]]],
so: [[1, [[0]]]],
sq: [[1, [[0]]]],
sr: [
[
1,
[
[8, 23, 24],
[25, 26]
]
],
[
3,
[
[8, 27, 28],
[29, 30]
]
]
],
ss: [[1, [[0]]]],
ssy: [[1, [[0]]]],
st: [[1, [[0]]]],
su: [],
sv: [[1, [[7, 8]]]],
sw: [[1, [[7, 8]]]],
syr: [[1, [[0]]]],
ta: [[1, [[0]]]],
te: [[1, [[0]]]],
teo: [[1, [[0]]]],
th: [],
ti: [[1, [[1]]]],
tig: [[1, [[0]]]],
tk: [[1, [[0]]]],
tl: [
[
1,
[
[8, 31],
[8, 32],
[33, 34]
]
]
],
tn: [[1, [[0]]]],
to: [],
tr: [[1, [[0]]]],
ts: [[1, [[0]]]],
tzm: [[1, [[1], [82]]]],
ug: [[1, [[0]]]],
uk: [
[1, [[8, 23, 24]]],
[3, [[8, 27, 28]]],
[
4,
[
[8, 77],
[8, 74],
[8, 78]
]
]
],
ur: [[1, [[7, 8]]]],
uz: [[1, [[0]]]],
ve: [[1, [[0]]]],
vi: [],
vo: [[1, [[0]]]],
vun: [[1, [[0]]]],
wa: [[1, [[1]]]],
wae: [[1, [[0]]]],
wo: [],
xh: [[1, [[0]]]],
xog: [[1, [[0]]]],
yi: [[1, [[7, 8]]]],
yo: [],
yue: [],
zh: [],
zu: [[1, [[2], [0]]]]
};
exports.ordinalRules = {
af: 'F|1',
am: 'F|1',
an: 'F|1',
ar: 'F|1',
as: 'B|84_C|85_D|86_E|38_F|1',
az: 'B|87|88_D|89|90_E|3|91|92_F|1',
be: 'D|93&94_F|1',
bg: 'F|1',
bn: 'B|84_C|85_D|86_E|38_F|1',
bs: 'F|1',
ca: 'B|95_C|5_D|86_F|1',
ce: 'F|1',
cs: 'F|1',
cy: 'A|96_B|0_C|5_D|97_E|98_F|1',
da: 'F|1',
de: 'F|1',
dsb: 'F|1',
el: 'F|1',
en: 'B|10&11_C|18&99_D|100&101_F|1',
es: 'F|1',
et: 'F|1',
eu: 'F|1',
fa: 'F|1',
fi: 'F|1',
fil: 'B|0_F|1',
fr: 'B|0_F|1',
fy: 'F|1',
ga: 'B|0_F|1',
gd: 'B|49_C|50_D|102_F|1',
gl: 'F|1',
gsw: 'F|1',
gu: 'B|0_C|85_D|86_E|38_F|1',
he: 'F|1',
hi: 'B|0_C|85_D|86_E|38_F|1',
hr: 'F|1',
hsb: 'F|1',
hu: 'B|103_F|1',
hy: 'B|0_F|1',
ia: 'F|1',
id: 'F|1',
in: 'F|1',
is: 'F|1',
it: 'E|104_F|1',
iw: 'F|1',
ja: 'F|1',
ka: 'B|8_E|3|105_F|1',
kk: 'E|106|107|14&22_F|1',
km: 'F|1',
kn: 'F|1',
ko: 'F|1',
kw: 'B|108|109_E|110|111_F|1',
ky: 'F|1',
lo: 'B|0_F|1',
lt: 'F|1',
lv: 'F|1',
mk: 'B|24&25_C|52&112_E|113&114_F|1',
ml: 'F|1',
mn: 'F|1',
mo: 'B|0_F|1',
mr: 'B|0_C|85_D|86_F|1',
ms: 'B|0_F|1',
my: 'F|1',
nb: 'F|1',
ne: 'B|108_F|1',
nl: 'F|1',
or: 'B|115_C|85_D|86_E|38_F|1',
pa: 'F|1',
pl: 'F|1',
prg: 'F|1',
ps: 'F|1',
pt: 'F|1',
ro: 'B|0_F|1',
root: 'F|1',
ru: 'F|1',
sc: 'E|104_F|1',
scn: 'E|104_F|1',
sd: 'F|1',
sh: 'F|1',
si: 'F|1',
sk: 'F|1',
sl: 'F|1',
sq: 'B|0_E|116&117_F|1',
sr: 'F|1',
sv: 'B|118&119_F|1',
sw: 'F|1',
ta: 'F|1',
te: 'F|1',
th: 'F|1',
tk: 'D|120|121_F|1',
tl: 'B|0_F|1',
tr: 'F|1',
uk: 'D|100&101_F|1',
ur: 'F|1',
uz: 'F|1',
vi: 'B|0_F|1',
yue: 'F|1',
zh: 'F|1',
zu: 'F|1'
af: [],
am: [],
an: [],
ar: [],
as: [
[1, [[83]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
az: [
[1, [[86], [87]]],
[3, [[88], [89]]],
[4, [[2], [90], [91]]]
],
be: [[3, [[92, 93]]]],
bg: [],
bn: [
[1, [[83]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
bs: [],
ca: [
[1, [[94]]],
[2, [[4]]],
[3, [[85]]]
],
ce: [],
cs: [],
cy: [
[0, [[95]]],
[1, [[0]]],
[2, [[4]]],
[3, [[96]]],
[4, [[97]]]
],
da: [],
de: [],
dsb: [],
el: [],
en: [
[1, [[9, 10]]],
[2, [[17, 98]]],
[3, [[99, 100]]]
],
es: [],
et: [],
eu: [],
fa: [],
fi: [],
fil: [[1, [[0]]]],
fr: [[1, [[0]]]],
fy: [],
ga: [[1, [[0]]]],
gd: [
[1, [[48]]],
[2, [[49]]],
[3, [[101]]]
],
gl: [],
gsw: [],
gu: [
[1, [[0]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
he: [],
hi: [
[1, [[0]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
hr: [],
hsb: [],
hu: [[1, [[102]]]],
hy: [[1, [[0]]]],
ia: [],
id: [],
in: [],
is: [],
it: [[4, [[103]]]],
iw: [],
ja: [],
ka: [
[1, [[7]]],
[4, [[2], [104]]]
],
kk: [[4, [[105], [106], [13, 21]]]],
km: [],
kn: [],
ko: [],
kw: [
[1, [[107], [108]]],
[4, [[109], [110]]]
],
ky: [],
lo: [[1, [[0]]]],
lt: [],
lv: [],
mk: [
[1, [[23, 24]]],
[2, [[51, 111]]],
[4, [[112, 113]]]
],
ml: [],
mn: [],
mo: [[1, [[0]]]],
mr: [
[1, [[0]]],
[2, [[84]]],
[3, [[85]]]
],
ms: [[1, [[0]]]],
my: [],
nb: [],
ne: [[1, [[107]]]],
nl: [],
or: [
[1, [[114]]],
[2, [[84]]],
[3, [[85]]],
[4, [[37]]]
],
pa: [],
pl: [],
prg: [],
ps: [],
pt: [],
ro: [[1, [[0]]]],
root: [],
ru: [],
sc: [[4, [[103]]]],
scn: [[4, [[103]]]],
sd: [],
sh: [],
si: [],
sk: [],
sl: [],
sq: [
[1, [[0]]],
[4, [[115, 116]]]
],
sr: [],
sv: [[1, [[117, 118]]]],
sw: [],
ta: [],
te: [],
th: [],
tk: [[3, [[119], [120]]]],
tl: [[1, [[0]]]],
tr: [],
uk: [[3, [[99, 100]]]],
ur: [],
uz: [],
vi: [[1, [[0]]]],
yue: [],
zh: [],
zu: []
};
exports.expressions = [
'n0:1',
'',
'n0:0:1',
'i0:0',
'n0:0',
'n0:2',
'n100:3:10',
'n100:11:99',
'i0:1',
'v0:0',
'n10:1',
'n100!:11',
'n10:2:4',
'n100!:12:14',
'n10:0',
'n10:5:9',
'n100:11:14',
'n100!:11,71,91',
'n10:2',
'n100!:12,72,92',
'n10:3:4,9',
'n100!:10:19,70:79,90:99',
'n0!:0',
'n1000000:0',
'i10:1',
'i100!:11',
'f10:1',
'f100!:11',
'i10:2:4',
'i100!:12:14',
'f10:2:4',
'f100!:12:14',
'i0:1,2,3',
'i10!:4,6,9',
'v0!:0',
'f10!:4,6,9',
'i0:2:4',
'n0:3',
'n0:6',
't0!:0',
'i0:0,1',
'i100:1',
'f100:1',
'i100:2',
'f100:2',
'i100:3:4',
'f100:3:4',
'n0:3:6',
'n0:7:10',
'n0:1,11',
'n0:2,12',
'n0:3:10,13:19',
'i10:2',
'i100:0,20,40,60,80',
'i0:2',
'n0!:0:10',
't0:0',
'n100:2,22,42,62,82',
'n1000:0',
'n100000:1000:20000,40000,60000,80000',
'n1000000:100000',
'n100:3,23,43,63,83',
'n0!:1',
'n100:1,21,41,61,81',
'n100!:11:19',
'n10:2:9',
'f0!:0',
'n100:11:19',
'v0:2',
'f100:11:19',
'v0!:2',
'n100:2:19',
'n100:2:10',
'i0!:1',
'i10:0:1',
'i10:5:9',
'i100:12:14',
'i0:0:1',
'i10:0',
'i100:11:14',
'n0:2:10',
'n0:0,1',
'f0:1',
'n0:11:99',
'n0:1,5,7,8,9,10',
'n0:2,3',
'n0:4',
'i10:1,2,5,7,8',
'i100:20,50,70,80',
'i10:3,4',
'i1000:100,200,300,400,500,600,700,800,900',
'i10:6',
'i100:40,60,90',
'n10:2,3',
'n100!:12,13',
'n0:1,3',
'n0:0,7,8,9',
'n0:3,4',
'n0:5,6',
'n100!:12',
'n10:3',
'n100!:13',
'n0:3,13',
'n0:1,5',
'n0:11,8,80,800',
'i100:2:20,40,60,80',
'n10:6',
'n10:9',
'n0:1:4',
'n100:1:4,21:24,41:44,61:64,81:84',
'n0:5',
'n100:5',
'i100!:12',
'i10:7,8',
'i100!:17,18',
'n0:1,5,7:9',
'n10:4',
'n100!:14',
'n10:1,2',
'n100!:11,12',
'n10:6,9',
'n0:10'
['n', 0, 1, [1]],
['n', 0, 1, [[0, 1]]],
['i', 0, 1, [0]],
['n', 0, 1, [0]],
['n', 0, 1, [2]],
['n', 100, 1, [[3, 10]]],
['n', 100, 1, [[11, 99]]],
['i', 0, 1, [1]],
['v', 0, 1, [0]],
['n', 10, 1, [1]],
['n', 100, 0, [11]],
['n', 10, 1, [[2, 4]]],
['n', 100, 0, [[12, 14]]],
['n', 10, 1, [0]],
['n', 10, 1, [[5, 9]]],
['n', 100, 1, [[11, 14]]],
['n', 100, 0, [11, 71, 91]],
['n', 10, 1, [2]],
['n', 100, 0, [12, 72, 92]],
['n', 10, 1, [[3, 4], 9]],
[
'n',
100,
0,
[
[10, 19],
[70, 79],
[90, 99]
]
],
['n', 0, 0, [0]],
['n', 1000000, 1, [0]],
['i', 10, 1, [1]],
['i', 100, 0, [11]],
['f', 10, 1, [1]],
['f', 100, 0, [11]],
['i', 10, 1, [[2, 4]]],
['i', 100, 0, [[12, 14]]],
['f', 10, 1, [[2, 4]]],
['f', 100, 0, [[12, 14]]],
['i', 0, 1, [1, 2, 3]],
['i', 10, 0, [4, 6, 9]],
['v', 0, 0, [0]],
['f', 10, 0, [4, 6, 9]],
['i', 0, 1, [[2, 4]]],
['n', 0, 1, [3]],
['n', 0, 1, [6]],
['t', 0, 0, [0]],
['i', 0, 1, [0, 1]],
['i', 100, 1, [1]],
['f', 100, 1, [1]],
['i', 100, 1, [2]],
['f', 100, 1, [2]],
['i', 100, 1, [[3, 4]]],
['f', 100, 1, [[3, 4]]],
['n', 0, 1, [[3, 6]]],
['n', 0, 1, [[7, 10]]],
['n', 0, 1, [1, 11]],
['n', 0, 1, [2, 12]],
[
'n',
0,
1,
[
[3, 10],
[13, 19]
]
],
['i', 10, 1, [2]],
['i', 100, 1, [0, 20, 40, 60, 80]],
['i', 0, 1, [2]],
['n', 0, 0, [[0, 10]]],
['t', 0, 1, [0]],
['n', 100, 1, [2, 22, 42, 62, 82]],
['n', 1000, 1, [0]],
['n', 100000, 1, [[1000, 20000], 40000, 60000, 80000]],
['n', 1000000, 1, [100000]],
['n', 100, 1, [3, 23, 43, 63, 83]],
['n', 0, 0, [1]],
['n', 100, 1, [1, 21, 41, 61, 81]],
['n', 100, 0, [[11, 19]]],
['n', 10, 1, [[2, 9]]],
['f', 0, 0, [0]],
['n', 100, 1, [[11, 19]]],
['v', 0, 1, [2]],
['f', 100, 1, [[11, 19]]],
['v', 0, 0, [2]],
['n', 100, 1, [[2, 19]]],
['n', 100, 1, [[2, 10]]],
['i', 0, 0, [1]],
['i', 10, 1, [[0, 1]]],
['i', 10, 1, [[5, 9]]],
['i', 100, 1, [[12, 14]]],
['i', 0, 1, [[0, 1]]],
['i', 10, 1, [0]],
['i', 100, 1, [[11, 14]]],
['n', 0, 1, [[2, 10]]],
['n', 0, 1, [0, 1]],
['f', 0, 1, [1]],
['n', 0, 1, [[11, 99]]],
['n', 0, 1, [1, 5, 7, 8, 9, 10]],
['n', 0, 1, [2, 3]],
['n', 0, 1, [4]],
['i', 10, 1, [1, 2, 5, 7, 8]],
['i', 100, 1, [20, 50, 70, 80]],
['i', 10, 1, [3, 4]],
['i', 1000, 1, [100, 200, 300, 400, 500, 600, 700, 800, 900]],
['i', 10, 1, [6]],
['i', 100, 1, [40, 60, 90]],
['n', 10, 1, [2, 3]],
['n', 100, 0, [12, 13]],
['n', 0, 1, [1, 3]],
['n', 0, 1, [0, 7, 8, 9]],
['n', 0, 1, [3, 4]],
['n', 0, 1, [5, 6]],
['n', 100, 0, [12]],
['n', 10, 1, [3]],
['n', 100, 0, [13]],
['n', 0, 1, [3, 13]],
['n', 0, 1, [1, 5]],
['n', 0, 1, [11, 8, 80, 800]],
['i', 100, 1, [[2, 20], 40, 60, 80]],
['n', 10, 1, [6]],
['n', 10, 1, [9]],
['n', 0, 1, [[1, 4]]],
[
'n',
100,
1,
[
[1, 4],
[21, 24],
[41, 44],
[61, 64],
[81, 84]
]
],
['n', 0, 1, [5]],
['n', 100, 1, [5]],
['i', 100, 0, [12]],
['i', 10, 1, [7, 8]],
['i', 100, 0, [17, 18]],
['n', 0, 1, [1, 5, [7, 9]]],
['n', 10, 1, [4]],
['n', 100, 0, [14]],
['n', 10, 1, [1, 2]],
['n', 100, 0, [11, 12]],
['n', 10, 1, [6, 9]],
['n', 0, 1, [10]]
];
//# sourceMappingURL=autogen.rules.js.map

@@ -0,3 +1,3 @@

export { pluralRules, Plurals } from './api';
export { NumberOperands } from './operands';
import { PluralRules } from './types';
export declare const pluralRules: PluralRules;
export { PluralRules } from './rules';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var autogen_rules_1 = require("./autogen.rules");
var api_1 = require("./api");
exports.pluralRules = api_1.pluralRules;
exports.Plurals = api_1.Plurals;
var operands_1 = require("./operands");
exports.NumberOperands = operands_1.NumberOperands;
var types_1 = require("./types");
exports.pluralRules = new types_1.PluralRules(autogen_rules_1.expressions, autogen_rules_1.cardinalRules, autogen_rules_1.ordinalRules);
var rules_1 = require("./rules");
exports.PluralRules = rules_1.PluralRules;
//# sourceMappingURL=index.js.map
import { Decimal } from '@phensley/decimal';
export declare type Operand = 'n' | 'i' | 'v' | 'w' | 'f' | 't';
/**

@@ -3,0 +4,0 @@ * Operands for use in evaluating localized plural rules:

@@ -1,67 +0,20 @@

import { Decimal, DecimalArg } from '@phensley/decimal';
import { NumberOperands } from './operands';
export declare type RuleMap = {
[x: string]: PluralRule;
};
export declare type StringMap = {
[x: string]: string;
};
export declare type Operand = 'n' | 'i' | 'v' | 'w' | 'f' | 't';
export declare const enum Op {
N = 0,
I = 1,
V = 2,
W = 4,
F = 8,
T = 16
export declare type RangeList = Array<number | Range>;
export interface Range {
[0]: number;
[1]: number;
}
export declare class RuleCache {
private strings;
private rules;
constructor(strings: StringMap);
get(language: string): PluralRule | undefined;
export interface Expr {
[0]: string;
[1]: number;
[2]: number;
[3]: RangeList;
}
/**
* Set of all cardinal and ordinal plural rules, and the array of expression
* fragments the rules reference.
*/
export declare class PluralRules {
private expressionsRaw;
private expressions;
private cardinals;
private ordinals;
constructor(expressionsRaw: string[], cardinalsRaw: StringMap, ordinalsRaw: StringMap);
operands(d: Decimal): NumberOperands;
cardinal(language: string, n: DecimalArg): string;
ordinal(language: string, n: DecimalArg): string;
private evaluate;
private execute;
private getExpression;
export declare type AndCond = Array<Expr>;
export declare type OrCond = Array<AndCond>;
export interface Rule {
[0]: number;
[1]: number[][];
}
/**
* Parses a packed plural rule, consisting of plural categories and the
* expressions.
*/
export declare class PluralRule {
readonly conditions: PluralCond[];
constructor(raw: string);
}
/**
* Parse a packed plural condition for a single category.
*/
export declare class PluralCond {
readonly category: string;
readonly conditions: number[][];
constructor(raw: string);
}
/**
* Parses a packed plural expression.
*/
export declare class PluralExpr {
readonly operand: Operand;
readonly operator: string;
readonly mod?: number;
readonly ranges: (number | number[])[];
constructor(raw: string);
}
export declare const evaluateExpr: (operands: NumberOperands, expr: PluralExpr) => boolean;
export declare type RuleMap = {
[x: string]: Rule[];
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var decimal_1 = require("@phensley/decimal");
var operands_1 = require("./operands");
// Notation for categories in compact plural rules
var CATEGORIES = {
'A': 'zero',
'B': 'one',
'C': 'two',
'D': 'few',
'E': 'many',
'F': 'other'
};
var RuleCache = /** @class */ (function () {
function RuleCache(strings) {
this.strings = strings;
this.rules = {};
}
RuleCache.prototype.get = function (language) {
var rule = this.rules[language];
if (rule === undefined) {
var raw = this.strings[language];
if (raw === undefined) {
return;
}
rule = new PluralRule(raw);
this.rules[language] = rule;
}
return rule;
};
return RuleCache;
}());
exports.RuleCache = RuleCache;
/**
* Set of all cardinal and ordinal plural rules, and the array of expression
* fragments the rules reference.
*/
var PluralRules = /** @class */ (function () {
function PluralRules(expressionsRaw, cardinalsRaw, ordinalsRaw) {
this.expressionsRaw = expressionsRaw;
this.expressions = new Array(expressionsRaw.length);
this.cardinals = new RuleCache(cardinalsRaw);
this.ordinals = new RuleCache(ordinalsRaw);
}
PluralRules.prototype.operands = function (d) {
return new operands_1.NumberOperands(d);
};
PluralRules.prototype.cardinal = function (language, n) {
return this.evaluate(language, new operands_1.NumberOperands(decimal_1.coerceDecimal(n)), this.cardinals);
};
PluralRules.prototype.ordinal = function (language, n) {
return this.evaluate(language, new operands_1.NumberOperands(decimal_1.coerceDecimal(n)), this.ordinals);
};
PluralRules.prototype.evaluate = function (language, operands, cache) {
var rule = cache.get(language);
if (rule === undefined) {
rule = cache.get('root');
}
if (rule !== undefined) {
for (var _i = 0, _a = rule.conditions; _i < _a.length; _i++) {
var cond = _a[_i];
if (this.execute(operands, cond.conditions)) {
return cond.category;
}
}
}
return 'other';
};
PluralRules.prototype.execute = function (operands, conditions) {
// Evaluate each condition and OR them together.
var len = conditions.length;
for (var i = 0; i < len; i++) {
var cond = conditions[i];
// Evaluate the inner expressions and AND them together.
var res = true;
for (var j = 0; j < cond.length; j++) {
var expr = this.getExpression(cond[j]);
res = res && exports.evaluateExpr(operands, expr);
if (!res) {
break;
}
}
if (res) {
return true;
}
}
return false;
};
PluralRules.prototype.getExpression = function (id) {
var expr = this.expressions[id];
if (expr === undefined) {
var raw = this.expressionsRaw[id];
expr = new PluralExpr(raw);
this.expressions[id] = expr;
}
return expr;
};
return PluralRules;
}());
exports.PluralRules = PluralRules;
/**
* Parses a packed plural rule, consisting of plural categories and the
* expressions.
*/
var PluralRule = /** @class */ (function () {
function PluralRule(raw) {
this.conditions = raw.split('_').map(function (s) { return new PluralCond(s); });
}
return PluralRule;
}());
exports.PluralRule = PluralRule;
/**
* Parse a packed plural condition for a single category.
*/
var PluralCond = /** @class */ (function () {
function PluralCond(raw) {
var parts = raw.split('|');
this.category = CATEGORIES[parts[0]];
this.conditions = parts.slice(1).map(function (o) { return o.split('&').map(Number); });
}
return PluralCond;
}());
exports.PluralCond = PluralCond;
/**
* Parses a packed plural expression.
*/
var PluralExpr = /** @class */ (function () {
function PluralExpr(raw) {
this.operand = raw[0];
var done = false;
this.operator = '=';
var mod = 0;
var i = 1;
while (i < raw.length) {
var ch = raw[i];
switch (ch) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
mod *= 10;
mod += Number(ch);
break;
case '!':
this.operator = '!';
break;
case ':':
i++;
done = true;
break;
}
if (done) {
break;
}
i++;
}
if (mod) {
this.mod = mod;
}
raw = raw.substring(i);
this.ranges = raw ? raw.split(',')
.map(function (s) { return s.indexOf(':') === -1 ? Number(s) : s.split(':').map(function (x) { return Number(x); }); }) : [];
}
return PluralExpr;
}());
exports.PluralExpr = PluralExpr;
exports.evaluateExpr = function (operands, expr) {
var operand = expr.operand, ranges = expr.ranges;
if (!operand) {
return false;
}
var n = operands[operand];
// The N = X..Y syntax means N matches an integer from X to Y inclusive
// Operand 'n' must always be compared as an integer, so if it has any non-zero decimal
// parts we must set integer = false.
var integer = operand === 'n' ? operands.w === 0 : true;
if (expr.mod) {
n = n % expr.mod;
}
var equals = expr.operator !== '!';
var len = ranges.length;
var res = false;
for (var i = 0; i < len; i++) {
var elem = ranges[i];
if (typeof elem === 'number') {
res = res || (integer && n === elem);
}
else {
res = res || (integer && elem[0] <= n && n <= elem[1]);
}
}
return equals ? res : !res;
};
//# sourceMappingURL=types.js.map
{
"name": "@phensley/plurals",
"version": "0.23.0",
"version": "0.24.0",
"description": "Plural rules engine",

@@ -37,3 +37,3 @@ "main": "lib/index.js",

"dependencies": {
"@phensley/decimal": "0.23.0",
"@phensley/decimal": "0.24.0",
"tslib": "1.10.x"

@@ -67,3 +67,3 @@ },

},
"gitHead": "8aa8004dbd6ea152a729226d3a1852de3fca2aea"
"gitHead": "ae7f446d2de34557ea00eb3b05be0e4acfe72e96"
}

@@ -47,3 +47,4 @@ @phensley/plurals

for (const lang of LANGUAGES) {
const cat = pluralRules.cardinal(lang, n);
const plurals = pluralRules.get(lang);
const cat = plurals.cardinal(n);
s += `${lang} ${cat}`.padEnd(14);

@@ -57,26 +58,26 @@ }

```
0.000000000000000000000000000001 en other fr one lt many pl other mt other
0.0000000000000003333333333 en other fr one lt many pl other mt other
0 en other fr one lt other pl many mt few
0.00 en other fr one lt other pl other mt few
0.5 en other fr one lt many pl other mt other
1 en one fr one lt one pl one mt one
1.0 en other fr one lt one pl other mt one
2 en other fr other lt few pl few mt few
3.14159 en other fr other lt many pl other mt other
5 en other fr other lt few pl many mt few
6 en other fr other lt few pl many mt few
7 en other fr other lt few pl many mt few
9 en other fr other lt few pl many mt few
11 en other fr other lt other pl many mt many
15 en other fr other lt other pl many mt many
19 en other fr other lt other pl many mt many
23 en other fr other lt few pl few mt other
29 en other fr other lt few pl many mt other
100 en other fr other lt other pl many mt other
1000000000000 en other fr other lt other pl many mt other
1000000000000.0 en other fr other lt other pl other mt other
9999999999999999999999919 en other fr other lt other pl many mt many
9999999999999999999999999 en other fr other lt few pl many mt other
1000000000000000000000000000000 en other fr other lt other pl many mt other
0.000000000000000000000000000001 en other fr one lt many pl other mt other pt one pt-PT other
0.0000000000000003333333333 en other fr one lt many pl other mt other pt one pt-PT other
0 en other fr one lt other pl many mt few pt one pt-PT other
0.00 en other fr one lt other pl other mt few pt one pt-PT other
0.5 en other fr one lt many pl other mt other pt one pt-PT other
1 en one fr one lt one pl one mt one pt one pt-PT one
1.0 en other fr one lt one pl other mt one pt one pt-PT other
2 en other fr other lt few pl few mt few pt other pt-PT other
3.14159 en other fr other lt many pl other mt other pt other pt-PT other
5 en other fr other lt few pl many mt few pt other pt-PT other
6 en other fr other lt few pl many mt few pt other pt-PT other
7 en other fr other lt few pl many mt few pt other pt-PT other
9 en other fr other lt few pl many mt few pt other pt-PT other
11 en other fr other lt other pl many mt many pt other pt-PT other
15 en other fr other lt other pl many mt many pt other pt-PT other
19 en other fr other lt other pl many mt many pt other pt-PT other
23 en other fr other lt few pl few mt other pt other pt-PT other
29 en other fr other lt few pl many mt other pt other pt-PT other
100 en other fr other lt other pl many mt other pt other pt-PT other
1000000000000 en other fr other lt other pl many mt other pt other pt-PT other
1000000000000.0 en other fr other lt other pl other mt other pt other pt-PT other
9999999999999999999999919 en other fr other lt other pl many mt many pt other pt-PT other
9999999999999999999999999 en other fr other lt few pl many mt other pt other pt-PT other
1000000000000000000000000000000 en other fr other lt other pl many mt other pt other pt-PT other
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc