fast-plural-rules
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n=n||self).fastPluralRules={})}(this,function(n){"use strict";var r=[function(){return 0},function(n){return 1===n?0:1},function(n){return n<=1?0:1},function(n){return n%10==1&&n%100!=11?1:n%10!=0?2:0},function(n){return 1===n||11===n?0:2===n||12===n?1:2<n&&n<20?2:3},function(n){return 1===n?0:0===n||0<n%100&&n%100<20?1:2},function(n){return n%10==1&&n%100!=11?0:2<=n%10&&(n%100<10||20<=n%100)?2:1},function(n){return n%10==1&&n%100!=11?0:2<=n%10&&n%10<=4&&(n%100<10||20<=n%100)?1:2},function(n){return 1===n?0:2<=n&&n<=4?1:2},function(n){return 1===n?0:2<=n%10&&n%10<=4&&(n%100<10||20<=n%100)?1:2},function(n){return n%100==1?0:n%100==2?1:n%100==3||n%100==4?2:3},function(n){return 1===n?0:2===n?1:2<n&&n<7?2:6<n&&n<11?3:4},function(n){return 1===n?0:2===n?1:3<=n%100&&n%100<=10?2:11<=n%100?3:0!==n?4:5},function(n){return 1===n?0:0===n||0<n%100&&n%100<11?1:10<n%100&&n%100<20?2:3},function(n){return n%10==1?0:n%10==2?1:2},function(n){return n%10==1&&n%100!=11?0:1},function(n){return 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?0!==n&&n%1e6==0?3:4:2},function(n){return 0!==n?1:0},function(n){return 1===n?1:2===n?2:3===n?3:6===n?4:0!==n?5:0},function(n){return 1===n?0:2<=n%10&&n%10<=4&&(n%100<10||20<=n%100)?1:2},function(n){return 1===n?0:2===n?1:3===n?2:3},function(n){return n%10==1&&n%100!=11?0:2<=n%10&&n%10<=4&&(n%100<10||20<=n%100)?1:2},function(n){return 0===n?0:1===n?1:2}],u={ach:2,af:1,ak:2,am:2,an:1,anp:1,ar:12,arn:2,as:1,ast:1,ay:0,az:1,be:7,bg:1,bn:1,bo:0,br:2,brx:1,bs:7,ca:1,cgg:0,cs:8,csb:19,cy:18,da:1,de:1,doi:1,dz:0,el:1,en:1,eo:1,es:1,"es-ar":1,et:1,eu:1,fa:2,ff:1,fi:1,fil:2,fo:1,fr:2,fur:1,fy:1,ga:11,gd:4,gl:1,gu:1,gun:2,ha:1,he:1,hi:1,hne:1,hr:7,hu:1,hy:1,ia:1,id:0,is:15,it:1,ja:0,jbo:0,jv:17,ka:0,kk:1,kl:1,km:0,kn:1,ko:0,ku:1,kw:20,ky:1,lb:1,ln:2,lo:0,lt:6,lv:3,mai:1,me:21,mfe:2,mg:2,mi:2,mk:15,ml:1,mn:1,mni:1,mnk:22,mr:1,ms:0,mt:13,my:0,nah:1,nap:1,nb:1,ne:1,nl:1,nn:1,no:1,nso:1,oc:2,or:1,pa:1,pap:1,pl:9,pms:1,ps:1,pt:1,"pt-br":2,rm:1,ro:5,ru:7,rw:1,sah:0,sat:1,sco:1,sd:1,se:1,si:1,sk:8,sl:10,so:1,son:1,sq:1,sr:7,su:0,sv:1,sw:1,ta:1,te:1,tg:2,th:0,ti:2,tk:1,tr:2,tt:0,ug:0,uk:7,ur:1,uz:2,vi:0,wa:2,wo:0,yo:1,"zh-cn":0,"zh-tw":2},o=[["other"],["one","other"],["one","other"],["zero","one","other"],["one","two","few","other"],["one","few","other"],["one","few","other"],["one","few","other"],["one","few","other"],["one","few","other"],["one","two","few","other"],["one","two","few","many","other"],["one","two","few","many","other","zero"],["one","few","many","other"],["one","few","other"],["one","other"],["one","two","few","many","other"],["zero","other"],["zero","one","two","few","many","other"],["one","few","other"],["one","two","few","other"],["one","few","other"],["zero","one","other"]];function t(n){n=n.toLowerCase().replace("_","-");var e,r,o=u[n];if(void 0===o){var t=0<(r=(e=n).indexOf("-"))?e.substr(0,r):e;o=u[t]}if(void 0===o)throw new Error('Unrecognized locale: "'+n+'".');return o}function a(e,n){var r=o[n];return function(n){return r[e(n)]}}function i(n){var e=t(n);return r[e]}function f(n){var e=r[n];if(void 0===e)throw new Error('Invalid index: "'+n+'".');return e}function l(n){var e=t(n);return a(r[e],e)}function c(n){if(void 0===r[n])throw new Error('Invalid index: "'+n+'".');return a(r[n],n)}n.getPluralFormForCardinalByIndex=function(n,e){return f(n)(e)},n.getPluralFormForCardinalByLocale=function(n,e){return i(n)(e)},n.getPluralFormNameForCardinalByIndex=function(n,e){return c(n)(e)},n.getPluralFormNameForCardinalByLocale=function(n,e){return l(n)(e)},n.getPluralRuleForCardinalsByIndex=f,n.getPluralRuleForCardinalsByLocale=i,n.getPluralRuleForNamedFormsForCardinalsByIndex=c,n.getPluralRuleForNamedFormsForCardinalsByLocale=l,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n=n||self).fastPluralRules={})}(this,function(n){"use strict";var r=[function(){return 0},function(n){return 1===n?0:1},function(n){return n<=1?0:1},function(n){return n%10==1&&n%100!=11?1:n%10!=0?2:0},function(n){return 1===n||11===n?0:2===n||12===n?1:2<n&&n<20?2:3},function(n){return 1===n?0:0===n||0<n%100&&n%100<20?1:2},function(n){return n%10==1&&n%100!=11?0:2<=n%10&&(n%100<10||20<=n%100)?2:1},function(n){return n%10==1&&n%100!=11?0:2<=n%10&&n%10<=4&&(n%100<10||20<=n%100)?1:2},function(n){return 1===n?0:2<=n&&n<=4?1:2},function(n){return 1===n?0:2<=n%10&&n%10<=4&&(n%100<10||20<=n%100)?1:2},function(n){return n%100==1?0:n%100==2?1:n%100==3||n%100==4?2:3},function(n){return 1===n?0:2===n?1:2<n&&n<7?2:6<n&&n<11?3:4},function(n){return 1===n?0:2===n?1:3<=n%100&&n%100<=10?2:11<=n%100?3:0!==n?4:5},function(n){return 1===n?0:0===n||0<n%100&&n%100<11?1:10<n%100&&n%100<20?2:3},function(n){return n%10==1?0:n%10==2?1:2},function(n){return n%10==1&&n%100!=11?0:1},function(n){return 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?0!==n&&n%1e6==0?3:4:2},function(n){return 0!==n?1:0},function(n){return 1===n?1:2===n?2:3===n?3:6===n?4:0!==n?5:0},function(n){return 1===n?0:2<=n%10&&n%10<=4&&(n%100<10||20<=n%100)?1:2},function(n){return 1===n?0:2===n?1:3===n?2:3},function(n){return n%10==1&&n%100!=11?0:2<=n%10&&n%10<=4&&(n%100<10||20<=n%100)?1:2},function(n){return 0===n?0:1===n?1:2}],o={ach:2,af:1,ak:2,am:2,an:1,anp:1,ar:12,arn:2,as:1,ast:1,ay:0,az:1,be:7,bg:1,bn:1,bo:0,br:2,brx:1,bs:7,ca:1,cgg:0,cs:8,csb:19,cy:18,da:1,de:1,doi:1,dz:0,el:1,en:1,eo:1,es:1,"es-ar":1,et:1,eu:1,fa:2,ff:1,fi:1,fil:2,fo:1,fr:2,fur:1,fy:1,ga:11,gd:4,gl:1,gu:1,gun:2,ha:1,he:1,hi:1,hne:1,hr:7,hu:1,hy:1,ia:1,id:0,is:15,it:1,ja:0,jbo:0,jv:17,ka:0,kk:1,kl:1,km:0,kn:1,ko:0,ku:1,kw:20,ky:1,lb:1,ln:2,lo:0,lt:6,lv:3,mai:1,me:21,mfe:2,mg:2,mi:2,mk:15,ml:1,mn:1,mni:1,mnk:22,mr:1,ms:0,mt:13,my:0,nah:1,nap:1,nb:1,ne:1,nl:1,nn:1,no:1,nso:1,oc:2,or:1,pa:1,pap:1,pl:9,pms:1,ps:1,pt:1,"pt-br":2,rm:1,ro:5,ru:7,rw:1,sah:0,sat:1,sco:1,sd:1,se:1,si:1,sk:8,sl:10,so:1,son:1,sq:1,sr:7,su:0,sv:1,sw:1,ta:1,te:1,tg:2,th:0,ti:2,tk:1,tr:2,tt:0,ug:0,uk:7,ur:1,uz:2,vi:0,wa:2,wo:0,yo:1,"zh-cn":0,"zh-tw":2},t=[["other"],["one","other"],["one","other"],["zero","one","other"],["one","two","few","other"],["one","few","other"],["one","few","other"],["one","few","other"],["one","few","other"],["one","few","other"],["one","two","few","other"],["one","two","few","many","other"],["one","two","few","many","other","zero"],["one","few","many","other"],["one","few","other"],["one","other"],["one","two","few","many","other"],["zero","other"],["zero","one","two","few","many","other"],["one","few","other"],["one","two","few","other"],["one","few","other"],["zero","one","other"]];function u(n){n=function(n){return n.toLowerCase().replace("_","-")}(n);var e=o[n];if(void 0===e){var r=function(n){var e=n.indexOf("-");return 0<e?n.substr(0,e):n}(n);e=o[r]}if(void 0===e)throw new Error('Unrecognized locale: "'+n+'".');return e}function a(e,n){var r=t[n];return function(n){return r[e(n)]}}function i(n){var e=u(n);return r[e]}function f(n){var e=r[n];if(void 0===e)throw new Error('Invalid index: "'+n+'".');return e}function c(n){var e=u(n);return a(r[e],e)}function l(n){if(void 0===r[n])throw new Error('Invalid index: "'+n+'".');return a(r[n],n)}n.getPluralFormForCardinalByIndex=function(n,e){return f(n)(e)},n.getPluralFormForCardinalByLocale=function(n,e){return i(n)(e)},n.getPluralFormNameForCardinalByIndex=function(n,e){return l(n)(e)},n.getPluralFormNameForCardinalByLocale=function(n,e){return c(n)(e)},n.getPluralRuleForCardinalsByIndex=f,n.getPluralRuleForCardinalsByLocale=i,n.getPluralRuleForNamedFormsForCardinalsByIndex=l,n.getPluralRuleForNamedFormsForCardinalsByLocale=c,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.umd.min.js.map |
{ | ||
"name": "fast-plural-rules", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Evaluates locale-specific plural rules to identify the right plural form for a cardinal number, which represents an item count.", | ||
@@ -85,6 +85,6 @@ "author": { | ||
"devDependencies": { | ||
"@babel/core": "7.5.5", | ||
"@babel/preset-env": "7.5.5", | ||
"@babel/core": "7.6.2", | ||
"@babel/preset-env": "7.6.2", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-jest": "24.8.0", | ||
"babel-jest": "24.9.0", | ||
"benchmark": "2.1.4", | ||
@@ -94,29 +94,29 @@ "cldr-data": "35.1.0", | ||
"connect": "3.7.0", | ||
"coveralls": "3.0.5", | ||
"coveralls": "3.0.6", | ||
"cpy-cli": "2.0.0", | ||
"es6-promisify": "6.0.1", | ||
"eslint-config-standard": "13.0.1", | ||
"es6-promisify": "6.0.2", | ||
"eslint-config-standard": "14.1.0", | ||
"eslint-plugin-import": "2.18.2", | ||
"eslint-plugin-node": "9.1.0", | ||
"eslint-plugin-node": "10.0.0", | ||
"eslint-plugin-promise": "4.2.1", | ||
"eslint-plugin-standard": "4.0.0", | ||
"eslint-plugin-standard": "4.0.1", | ||
"fast-glob": "3.0.4", | ||
"fs-extra": "8.1.0", | ||
"jasmine-core": "3.4.0", | ||
"jest": "24.8.0", | ||
"jasmine-core": "3.5.0", | ||
"jest": "24.9.0", | ||
"jest-expect-message": "1.0.2", | ||
"npm-run-all": "4.1.5", | ||
"plural-rules": "0.0.2", | ||
"puppeteer": "1.19.0", | ||
"plural-rules": "1.0.0", | ||
"puppeteer": "1.20.0", | ||
"regenerator-runtime": "0.13.3", | ||
"rimraf": "2.6.3", | ||
"rollup": "1.17.0", | ||
"rimraf": "3.0.0", | ||
"rollup": "1.21.4", | ||
"rollup-plugin-babel": "4.3.3", | ||
"rollup-plugin-cleanup": "3.1.1", | ||
"rollup-plugin-uglify": "6.0.2", | ||
"rollup-plugin-uglify": "6.0.3", | ||
"serve-static": "1.14.1", | ||
"standard": "13.1.0", | ||
"tslint": "5.18.0", | ||
"standard": "14.3.1", | ||
"tslint": "5.20.0", | ||
"tslint-config-standard": "8.0.1", | ||
"typescript": "3.5.3" | ||
"typescript": "3.6.3" | ||
}, | ||
@@ -123,0 +123,0 @@ "keywords": [ |
@@ -15,3 +15,3 @@ # Fast Plural Rules | ||
* Focused and complete - [nothing but the rule evaluation](./src/index.d.ts) is included, but still [supporting almost 150 languages](./docs/languages.md#supported-languages). | ||
* Tiny and [fast](./docs/speed.md#plural-form-lookup-speed) - 3 kB minified, 1 kB gzipped. Using [plain hand-coded functions](./src/cardinals.js) as [plural rules](./docs/design.md#plural-rules) to pick [plural forms](./docs/design.md#plural-forms) using [language locales](./docs/design.md#locales). | ||
* Tiny and [fast](./docs/speed.md#plural-form-lookup-speed) - 7.27 kB, 4.8 kB minified, 1.32 kB, gzipped. Using [plain hand-coded functions](./src/cardinals.js) as [plural rules](./docs/design.md#plural-rules) to pick [plural forms](./docs/design.md#plural-forms) using [language locales](./docs/design.md#locales). | ||
* Standard and documented - written using the [Translate Project documentation] and the [Mozilla documentation]. | ||
@@ -21,3 +21,3 @@ * Reliable and correct - contains the [full test suite] [comparing the actual results with the Mozilla specification], run in both Node.js and the browser. | ||
If you are looking for a library compiling and executing the declarative [CLDR plural rules], see [plural-rules]. Generated programmatically for better reliability, but a little bigger and slower. | ||
If you are looking for a library compiling and executing the declarative [CLDR plural rules], see [plural-rules]. Generated programmatically for better reliability, but bigger and slower. | ||
@@ -24,0 +24,0 @@ ### Table of Contents |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131615