diff --git a/src/cardinals.js b/src/cardinals.js
index eb7e215..131cbf1 100644
--- a/src/cardinals.js
+++ b/src/cardinals.js
@@ -120,7 +120,8 @@ const cardinals = {
// everything else: 2, 3, 4, 5, 6, 7, 8, 9, 22, 23, 24, 25, 26, 27, 28, 29,
// 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49, 52, 53,
// 54, 55, 56, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 72, 73, ...
- n => n % 10 === 1 && n % 100 !== 11 ? 0
+ n => n % 10 === 1 && n % 100 !== 11
+ ? 0
: n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 2 : 1,
// Plural rule #7 (3 forms)
@@ -139,7 +140,8 @@ const cardinals = {
// 20, 25, 26, 27, 28, 29, 30, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49,
// 50, 55, 56, 57, 58, 59, 60, 65, 66, 67, 68, 69, 70, 75, 76, 77, ..., 112,
// 113, ..., 212, 213, ...
- n => n % 10 === 1 && n % 100 !== 11 ? 0
+ n => n % 10 === 1 && n % 100 !== 11
+ ? 0
: n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
// Plural rule #8 (3 forms)
@@ -165,7 +167,8 @@ const cardinals = {
// everything else: 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
// 20, 21, 25, 26, 27, 28, 29, 30, 31, 35, 36, 37, 38, 39, 40, 41, 45, 46,
// 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 65, 66, 67, 68, ...
- n => n === 1 ? 0
+ n => n === 1
+ ? 0
: n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
// Plural rule #10 (4 forms)
@@ -207,8 +210,13 @@ const cardinals = {
// 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, ...
// ends in 00-02, excluding 0-2: 100, 101, 102, 200, 201, 202, ...
// is 0: 0
- n => n === 1 ? 0 : n === 2 ? 1 : n % 100 >= 3 && n % 100 <= 10 ? 2
- : n % 100 >= 11 ? 3 : n !== 0 ? 4 : 5,
+ n => n === 1
+ ? 0
+ : n === 2
+ ? 1
+ : n % 100 >= 3 && n % 100 <= 10
+ ? 2
+ : n % 100 >= 11 ? 3 : n !== 0 ? 4 : 5,
// Plural rule #13 (4 forms)
// Families: Semitic (Maltese)
@@ -223,8 +231,11 @@ const cardinals = {
// everything else: 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
// 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
// 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, ...
- n => n === 1 ? 0 : n === 0 || (n % 100 > 0 && n % 100 < 11) ? 1
- : n % 100 > 10 && n % 100 < 20 ? 2 : 3,
+ n => n === 1
+ ? 0
+ : n === 0 || (n % 100 > 0 && n % 100 < 11)
+ ? 1
+ : n % 100 > 10 && n % 100 < 20 ? 2 : 3,
// Plural rule #14 (3 forms)
// Families: Unused
@@ -265,14 +276,18 @@ const cardinals = {
// 6000000, 7000000, 8000000, 9000000, 10000000, ...
// everything else: 0, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
// 20, 25, 26, 27, 28, 30, 35, 36, 37, 38, 40, ...
- n => n % 10 === 1 && n % 100 !== 11 && n % 100 !== 71 && n % 100 !== 91 ? 0
- : n % 10 === 2 && n % 100 !== 12 && n % 100 !== 72 && n % 100 !== 92 ? 1
+ n => n % 10 === 1 && n % 100 !== 11 && n % 100 !== 71 && n % 100 !== 91
+ ? 0
+ : n % 10 === 2 && n % 100 !== 12 && n % 100 !== 72 && n % 100 !== 92
+ ? 1
: (n % 10 === 3 || n % 10 === 4 || n % 10 === 9) &&
n % 100 !== 13 && n % 100 !== 73 && n % 100 !== 93 &&
n % 100 !== 14 && n % 100 !== 74 && n % 100 !== 94 &&
- n % 100 !== 19 && n % 100 !== 79 && n % 100 !== 99 ? 2
- : n !== 0 && n % 1000000 === 0 ? 3
- : 4,
+ n % 100 !== 19 && n % 100 !== 79 && n % 100 !== 99
+ ? 2
+ : n !== 0 && n % 1000000 === 0
+ ? 3
+ : 4,
// Plural rule #17 (2 forms)
// Families: Ecuador indigenous languages (Shuar)
@@ -310,7 +325,8 @@ const cardinals = {
// 20, 21, 25, 26, 27, 28, 29, 30, 31, 35, 36, 37, 38, 39, 40, 41, 45, 46,
// 47, 48, 49, 50, 51, 55, 56, 57, 58, 59, 60, 61, 65, 66, 67, 68, 69, 70,
// 71, 75, 76, 77, ..., 111, 115, ..., 211, 215, ...
- n => n === 1 ? 0
+ n => n === 1
+ ? 0
: n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
// Plural rule #20 (4 forms)
@@ -338,7 +354,8 @@ const cardinals = {
// 20, 25, 26, 27, 28, 29, 30, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49,
// 50, 55, 56, 57, 58, 59, 60, 65, 66, 67, 68, 69, 70, 75, 76, 77, ..., 112,
// 113, ..., 212, 213, ...
- n => n % 10 === 1 && n % 100 !== 11 ? 0
+ n => n % 10 === 1 && n % 100 !== 11
+ ? 0
: n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
// Plural rule #22 (3 forms)
diff --git a/src/index.d.ts b/src/index.d.ts
index e97c15f..98f63e8 100644
--- a/src/index.d.ts
+++ b/src/index.d.ts
@@ -1,20 +1,23 @@
+declare type getPluralFormForCardinal = (count: number) => number
+
declare function getPluralFormForCardinalByLocale (locale: string, count: number): number
declare function getPluralFormNameForCardinalByLocale (locale: string, count: number): string
declare function getPluralFormForCardinalByIndex (index: number, count: number): number
declare function getPluralFormNameForCardinalByIndex (index: number, count: number): string
-declare function getPluralRuleForCardinalsByLocale (locale: string): Function
-declare function getPluralRuleForNamedFormsForCardinalsByLocale (locale: string): Function
+declare function getPluralRuleForCardinalsByLocale (locale: string): getPluralFormForCardinal
+declare function getPluralRuleForNamedFormsForCardinalsByLocale (locale: string): getPluralFormForCardinal
-declare function getPluralRuleForCardinalsByIndex (index: number): Function
-declare function getPluralRuleForNamedFormsForCardinalsByIndex (index: number): Function
+declare function getPluralRuleForCardinalsByIndex (index: number): getPluralFormForCardinal
+declare function getPluralRuleForNamedFormsForCardinalsByIndex (index: number): getPluralFormForCardinal
export {
getPluralFormForCardinalByLocale, getPluralRuleForCardinalsByLocale,
getPluralFormNameForCardinalByLocale, getPluralRuleForNamedFormsForCardinalsByLocale,
getPluralFormForCardinalByIndex, getPluralRuleForCardinalsByIndex,
- getPluralFormNameForCardinalByIndex, getPluralRuleForNamedFormsForCardinalsByIndex
+ getPluralFormNameForCardinalByIndex, getPluralRuleForNamedFormsForCardinalsByIndex,
+ getPluralFormForCardinal
}
export as namespace fastPluralRules
diff --git a/test/browser.html b/test/browser.html
index 1245900..44ec3d2 100644
--- a/test/browser.html
+++ b/test/browser.html
@@ -10,6 +10,7 @@
-
+
+