message-format
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -12,2 +12,8 @@ # Changelog | ||
## 1.2.1 | ||
* **Internal** | ||
* Update metadata for new github org | ||
* Update dependencies | ||
## 1.2.0 | ||
@@ -14,0 +20,0 @@ |
@@ -5,3 +5,3 @@ # Contributing | ||
contributing, please read the | ||
[code of conduct](https://github.com/thetalecrafter/message-format/blob/master/CODE_OF_CONDUCT.md). | ||
[code of conduct](https://github.com/format-message/message-format/blob/master/CODE_OF_CONDUCT.md). | ||
@@ -8,0 +8,0 @@ ## Developing |
@@ -1,2 +0,2 @@ | ||
!function(r){function t(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return r[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var e={};return t.m=r,t.c=e,t.p="/",t(0)}([function(r,t,e){r.exports=e(1)},function(r,t,e){"use strict";(window.Intl||(window.Intl={})).MessageFormat=e(6)},function(r,t,e){"use strict";var n=function(r){return r&&r.__esModule?r["default"]:r},a=n(e(4)),l={locales:{},formats:{cache:{},number:{currency:{style:"currency",currency:"USD"},percent:{style:"percent"}},date:{"short":{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},"long":{month:"long",day:"numeric",year:"numeric"},full:{month:"long",day:"numeric",year:"numeric",weekday:"long"}},time:{"short":{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},"long":{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}}};Object.keys(a).forEach(function(r){var t=a[r],e=t.plural,n=t.ordinal;l.locales[r]={locale:r,plural:e,ordinal:n}}),r.exports=l},function(r){"use strict";var t=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},e=function(){function r(){var e=void 0===arguments[0]?{}:arguments[0],n=e.locale,a=e.data,l=e.formats,i=e.cache;t(this,r),this.originalLocale=n,this.localeData=a,this.formats=l,this.enableCache="boolean"==typeof i?i:!0}return r.prototype.interpret=function(r){return this.interpretSubs(r)},r.prototype.interpretSubs=function(r,t){var e=this;return r=r.map(function(r){return e.interpretElement(r,t)}),1===r.length?r[0]:function(t){for(var e="",n=0,a=r.length;a>n;++n)e+=r[n](t);return e}},r.prototype.interpretElement=function(r,t){if("string"==typeof r)return function(){return r};var e=r[0],n=r[1],a=r[2],l=0,i=void 0;switch("#"===e&&(e=t[0],n="selectordinal"===t[1]?"ordinal":"number",l=t[2],a=null),n){case"number":case"ordinal":case"spellout":case"duration":return this.interpretNumber(e,l,a);case"date":case"time":return this.interpretDateTime(e,n,a);case"plural":case"selectordinal":return l=r[2],i=r[3],this.interpretPlural(e,n,l,i);case"select":return this.interpretSelect(e,a);default:return this.interpretSimple(e)}},r.prototype.interpretNumber=function(r,t){var e=this,n=void 0===arguments[2]?"medium":arguments[2];t=t||0;var a=this.originalLocale,l=this.formats,i=l.cache,o=a+":number:"+n,u=void 0;return this.enableCache&&o in i?u=i[o]:!function(){var r=l.number[n];u="undefined"!=typeof Intl&&Intl.NumberFormat?new Intl.NumberFormat(a,r).format:function(t){return Number(t).toLocaleString(a,r)},e.enableCache&&(i[o]=u)}(),function(e){return u(+e[r]-t)}},r.prototype.interpretDateTime=function(r,t){var e=this,n=void 0===arguments[2]?"medium":arguments[2],a=this.originalLocale,l=this.formats,i=l.cache,o=a+":"+t+":"+n,u=void 0;return this.enableCache&&o in i?u=i[o]:!function(){var r=l[t][n],s="time"===t?"toLocaleTimeString":"toLocaleDateString";u="undefined"!=typeof Intl&&Intl.DateTimeFormat?new Intl.DateTimeFormat(a,r).format:function(t){return new Date(t)[s](a,r)},e.enableCache&&(i[o]=u)}(),function(t){return u(t[r])}},r.prototype.interpretPlural=function(r,t,e,n){var a=this,l="selectordinal"===t?this.localeData.ordinal:this.localeData.plural,i=[r,t,e],o={};return Object.keys(n).forEach(function(r){o[r]=a.interpretSubs(n[r],i)}),function(t){var n=+t[r],a="="+n,i=l?l(n-e):"other",u=o[a]||o[i]||o.other;return u(t)}},r.prototype.interpretSelect=function(r,t){var e=this,n={};return Object.keys(t).forEach(function(r){n[r]=e.interpretSubs(t[r],null)}),function(t){var e=t[r],a=n[e]||n.other;return a(t)}},r.prototype.interpretSimple=function(r){return function(t){return""+t[r]}},r.interpret=function(t,e){return new r(e).interpret(t)},r}();r.exports=e},function(r){"use strict";var t=[function(r){var t=+r;return 1===t?"one":"other"},function(r){var t=+r;return t>=0&&1>=t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===t||1===e?"one":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&10>=t%100?"few":t%100>=11&&99>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":"other"},function(r){var t=+r;return t%10===1&&t%100!==11?"one":t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":t%10===0||t%10>=5&&9>=t%10||t%100>=11&&14>=t%100?"many":"other"},function(){return"other"},function(r){var t=+r;return t%10===1&&t%100!==11&&t%100!==71&&t%100!==91?"one":t%10===2&&t%100!==12&&t%100!==72&&t%100!==92?"two":(t%10>=3&&4>=t%10||t%10===9)&&(10>t%100||t%100>19)&&(70>t%100||t%100>79)&&(90>t%100||t%100>99)?"few":0!==t&&t%1e6===0?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%10===1&&t%100!==11||n%10===1&&n%100!==11?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)||n%10>=2&&4>=n%10&&(12>n%100||n%100>14)?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":t>=2&&4>=t&&0===e?"few":0!==e?"many":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(""+r).replace(/^[^.]*.?|0+$/g,""),n=+r;return 1===n||0!==e&&(0===t||1===t)?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%100===1||n%100===1?"one":0===e&&t%100===2||n%100===2?"two":0===e&&t%100>=3&&4>=t%100||n%100>=3&&4>=n%100?"few":"other"},function(r){var t=Math.floor(Math.abs(+r));return 0===t||1===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&(1===t||2===t||3===t)||0===e&&t%10!==4&&t%10!==6&&t%10!==9||0!==e&&n%10!==4&&n%10!==6&&n%10!==9?"one":"other"},function(r){var t=+r;return 1===t?"one":2===t?"two":t>=3&&6>=t?"few":t>=7&&10>=t?"many":"other"},function(r){var t=+r;return 1===t||11===t?"one":2===t||12===t?"two":t>=3&&10>=t||t>=13&&19>=t?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%10===1?"one":0===e&&t%10===2?"two":0!==e||t%100!==0&&t%100!==20&&t%100!==40&&t%100!==60&&t%100!==80?0!==e?"many":"other":"few"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+r;return 1===t&&0===e?"one":2===t&&0===e?"two":0===e&&(0>n||n>10)&&n%10===0?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(""+r).replace(/^[^.]*.?|0+$/g,"");return 0===e&&t%10===1&&t%100!==11||0!==e?"one":"other"},function(r){var t=+r;return 1===t?"one":2===t?"two":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===e?"zero":0!==t&&1!==t||0===e?"other":"one"},function(r){var t=+(r+".").split(".")[1],e=+r;return e%10===1&&(11>e%100||e%100>19)?"one":e%10>=2&&9>=e%10&&(11>e%100||e%100>19)?"few":0!==t?"many":"other"},function(r){var t=(r+".").split(".")[1].length,e=+(r+".").split(".")[1],n=+r;return n%10===0||n%100>=11&&19>=n%100||2===t&&e%100>=11&&19>=e%100?"zero":n%10===1&&n%100!==11||2===t&&e%10===1&&e%100!==11||2!==t&&e%10===1?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%10===1||n%10===1?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+r;return 1===t&&0===e?"one":0!==e||0===n||1!==n&&n%100>=1&&19>=n%100?"few":"other"},function(r){var t=+r;return 1===t?"one":0===t||t%100>=2&&10>=t%100?"few":t%100>=11&&19>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":0===e&&1!==t&&t%10>=0&&1>=t%10||0===e&&t%10>=5&&9>=t%10||0===e&&t%100>=12&&14>=t%100?"many":"other"},function(r){var t=+r;return t>=0&&2>=t&&2!==t?"one":"other"},function(r){var t=(r+".").split(".")[1].length,e=+r;return 1===e&&0===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%10===1&&t%100!==11?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":0===e&&t%10===0||0===e&&t%10>=5&&9>=t%10||0===e&&t%100>=11&&14>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===t||1===e?"one":e>=2&&10>=e?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(r+".").split(".")[1],n=+r;return 0===n||1===n||0===t&&1===e?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%100===1?"one":0===e&&t%100===2?"two":0===e&&t%100>=3&&4>=t%100||0!==e?"few":"other"},function(r){var t=+r;return t>=0&&1>=t||t>=11&&99>=t?"one":"other"},function(r){var t=+r;return 1===t||5===t||7===t||8===t||9===t||10===t?"one":2===t||3===t?"two":4===t?"few":6===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return t%10===1||t%10===2||t%10===5||t%10===7||t%10===8||t%100===20||t%100===50||t%100===70||t%100===80?"one":t%10===3||t%10===4||t%1e3===100||t%1e3===200||t%1e3===300||t%1e3===400||t%1e3===500||t%1e3===600||t%1e3===700||t%1e3===800||t%1e3===900?"few":0===t||t%10===6||t%100===40||t%100===60||t%100===90?"many":"other"},function(r){var t=+r;return 1===t||3===t?"one":2===t?"two":4===t?"few":"other"},function(r){var t=+r;return 0===t||7===t||8===t||9===t?"zero":1===t?"one":2===t?"two":3===t||4===t?"few":5===t||6===t?"many":"other"},function(r){var t=+r;return t%10===1&&t%100!==11?"one":t%10===2&&t%100!==12?"two":t%10===3&&t%100!==13?"few":"other"},function(r){var t=+r;return 1===t?"one":2===t||3===t?"two":4===t?"few":6===t?"many":"other"},function(r){var t=+r;return 1===t||5===t?"one":"other"},function(r){var t=+r;return 11===t||8===t||80===t||800===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return 1===t?"one":0===t||t%100>=2&&20>=t%100||t%100===40||t%100===60||t%100===80?"many":"other"},function(r){var t=+r;return t%10===6||t%10===9||t%10===0&&0!==t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return t%10===1&&t%100!==11?"one":t%10===2&&t%100!==12?"two":t%10!==7&&t%10!==8||t%100===17||t%100===18?"other":"many"},function(r){var t=+r;return 1===t?"one":2===t||3===t?"two":4===t?"few":"other"},function(r){var t=+r;return t>=1&&4>=t?"one":"other"},function(r){var t=+r;return 1===t?"one":t%10===4&&t%100!==14?"many":"other"},function(r){var t=+r;return t%10!==1&&t%10!==2||t%100===11||t%100===12?"other":"one"},function(r){var t=+r;return t%10===3&&t%100!==13?"few":"other"}];r.exports={af:{plural:t[0],ordinal:t[6]},ak:{plural:t[1]},am:{plural:t[2],ordinal:t[6]},ar:{plural:t[3],ordinal:t[6]},as:{plural:t[2],ordinal:t[36]},asa:{plural:t[0]},ast:{plural:t[4]},az:{plural:t[0],ordinal:t[37]},be:{plural:t[5]},bem:{plural:t[0]},bez:{plural:t[0]},bg:{plural:t[0],ordinal:t[6]},bh:{plural:t[1]},bm:{plural:t[6]},bn:{plural:t[2],ordinal:t[36]},bo:{plural:t[6]},br:{plural:t[7]},brx:{plural:t[0]},bs:{plural:t[8],ordinal:t[6]},ca:{plural:t[4],ordinal:t[38]},ce:{plural:t[0],ordinal:t[6]},cgg:{plural:t[0]},chr:{plural:t[0]},ckb:{plural:t[0]},cs:{plural:t[9],ordinal:t[6]},cy:{plural:t[10],ordinal:t[39]},da:{plural:t[11],ordinal:t[6]},de:{plural:t[4],ordinal:t[6]},dsb:{plural:t[12],ordinal:t[6]},dv:{plural:t[0]},dz:{plural:t[6]},ee:{plural:t[0]},el:{plural:t[0],ordinal:t[6]},en:{plural:t[4],ordinal:t[40]},eo:{plural:t[0]},es:{plural:t[0],ordinal:t[6]},et:{plural:t[4],ordinal:t[6]},eu:{plural:t[0],ordinal:t[6]},fa:{plural:t[2],ordinal:t[6]},ff:{plural:t[13]},fi:{plural:t[4],ordinal:t[6]},fil:{plural:t[14],ordinal:t[0]},fo:{plural:t[0]},fr:{plural:t[13],ordinal:t[0]},fur:{plural:t[0]},fy:{plural:t[4],ordinal:t[6]},ga:{plural:t[15]},gd:{plural:t[16]},gl:{plural:t[4],ordinal:t[6]},gsw:{plural:t[0]},gu:{plural:t[2],ordinal:t[41]},guw:{plural:t[1]},gv:{plural:t[17]},ha:{plural:t[0]},haw:{plural:t[0]},he:{plural:t[18],ordinal:t[6]},hi:{plural:t[2],ordinal:t[41]},hr:{plural:t[8],ordinal:t[6]},hsb:{plural:t[12],ordinal:t[6]},hu:{plural:t[0],ordinal:t[42]},hy:{plural:t[13],ordinal:t[0]},id:{plural:t[6],ordinal:t[6]},ig:{plural:t[6]},ii:{plural:t[6]},"in":{plural:t[6],ordinal:t[6]},is:{plural:t[19],ordinal:t[6]},it:{plural:t[4],ordinal:t[43]},iu:{plural:t[20]},iw:{plural:t[18],ordinal:t[6]},ja:{plural:t[6],ordinal:t[6]},jbo:{plural:t[6]},jgo:{plural:t[0]},ji:{plural:t[4]},jmc:{plural:t[0]},jv:{plural:t[6]},jw:{plural:t[6]},ka:{plural:t[0],ordinal:t[44]},kab:{plural:t[13]},kaj:{plural:t[0]},kcg:{plural:t[0]},kde:{plural:t[6]},kea:{plural:t[6]},kk:{plural:t[0],ordinal:t[45]},kkj:{plural:t[0]},kl:{plural:t[0]},km:{plural:t[6],ordinal:t[6]},kn:{plural:t[2],ordinal:t[6]},ko:{plural:t[6],ordinal:t[6]},ks:{plural:t[0]},ksb:{plural:t[0]},ksh:{plural:t[21]},ku:{plural:t[0]},kw:{plural:t[20]},ky:{plural:t[0],ordinal:t[6]},lag:{plural:t[22]},lb:{plural:t[0]},lg:{plural:t[0]},lkt:{plural:t[6]},ln:{plural:t[1]},lo:{plural:t[6],ordinal:t[0]},lt:{plural:t[23],ordinal:t[6]},lv:{plural:t[24],ordinal:t[6]},mas:{plural:t[0]},mg:{plural:t[1]},mgo:{plural:t[0]},mk:{plural:t[25],ordinal:t[46]},ml:{plural:t[0],ordinal:t[6]},mn:{plural:t[0],ordinal:t[6]},mo:{plural:t[26],ordinal:t[0]},mr:{plural:t[2],ordinal:t[47]},ms:{plural:t[6],ordinal:t[0]},mt:{plural:t[27]},my:{plural:t[6],ordinal:t[6]},nah:{plural:t[0]},naq:{plural:t[20]},nb:{plural:t[0],ordinal:t[6]},nd:{plural:t[0]},ne:{plural:t[0],ordinal:t[48]},nl:{plural:t[4],ordinal:t[6]},nn:{plural:t[0]},nnh:{plural:t[0]},no:{plural:t[0]},nqo:{plural:t[6]},nr:{plural:t[0]},nso:{plural:t[1]},ny:{plural:t[0]},nyn:{plural:t[0]},om:{plural:t[0]},or:{plural:t[0]},os:{plural:t[0]},pa:{plural:t[1],ordinal:t[6]},pap:{plural:t[0]},pl:{plural:t[28],ordinal:t[6]},prg:{plural:t[24],ordinal:t[6]},ps:{plural:t[0]},pt:{plural:t[29],ordinal:t[6]},"pt-PT":{plural:t[30]},rm:{plural:t[0]},ro:{plural:t[26],ordinal:t[0]},rof:{plural:t[0]},root:{plural:t[6],ordinal:t[6]},ru:{plural:t[31],ordinal:t[6]},rwk:{plural:t[0]},sah:{plural:t[6]},saq:{plural:t[0]},se:{plural:t[20]},seh:{plural:t[0]},ses:{plural:t[6]},sg:{plural:t[6]},sh:{plural:t[8],ordinal:t[6]},shi:{plural:t[32]},si:{plural:t[33],ordinal:t[6]},sk:{plural:t[9],ordinal:t[6]},sl:{plural:t[34],ordinal:t[6]},sma:{plural:t[20]},smi:{plural:t[20]},smj:{plural:t[20]},smn:{plural:t[20]},sms:{plural:t[20]},sn:{plural:t[0]},so:{plural:t[0]},sq:{plural:t[0],ordinal:t[49]},sr:{plural:t[8],ordinal:t[6]},ss:{plural:t[0]},ssy:{plural:t[0]},st:{plural:t[0]},sv:{plural:t[4],ordinal:t[50]},sw:{plural:t[4],ordinal:t[6]},syr:{plural:t[0]},ta:{plural:t[0],ordinal:t[6]},te:{plural:t[0],ordinal:t[6]},teo:{plural:t[0]},th:{plural:t[6],ordinal:t[6]},ti:{plural:t[1]},tig:{plural:t[0]},tk:{plural:t[0]},tl:{plural:t[14],ordinal:t[0]},tn:{plural:t[0]},to:{plural:t[6]},tr:{plural:t[0],ordinal:t[6]},ts:{plural:t[0]},tzm:{plural:t[35]},ug:{plural:t[0]},uk:{plural:t[31],ordinal:t[51]},ur:{plural:t[4],ordinal:t[6]},uz:{plural:t[0],ordinal:t[6]},ve:{plural:t[0]},vi:{plural:t[6],ordinal:t[0]},vo:{plural:t[0]},vun:{plural:t[0]},wa:{plural:t[1]},wae:{plural:t[0]},wo:{plural:t[6]},xh:{plural:t[0]},xog:{plural:t[0]},yi:{plural:t[4]},yo:{plural:t[6]},zh:{plural:t[6],ordinal:t[6]},zu:{plural:t[2],ordinal:t[6]}}},function(r){"use strict";function t(r,t){for(var e=[].concat(r||[]),n=0,a=e.length;a>n;++n)for(var l=e[n].split("-");l.length;){if(l.join("-")in t)return l.join("-");l.pop()}return"en"}r.exports=t},function(r,t,e){"use strict";function n(r,t){var e=void 0===arguments[2]?{}:arguments[2];if("object"!=typeof this||!(this instanceof n))return new n(r,t,e);if("string"!=typeof r)throw new TypeError("message pattern must be a string");var a=o(t,n.data.locales),u=n.data.locales[a],s="cache"in e?e.cache:!0,p=n.data.formats.cache,h=a+":message:"+r,c=n.data.formats,f=void 0;s&&h in p?f=p[h]:(f=i.interpret(l.parse(r,{escape:e.escape}),{locale:t,data:u,formats:c,cache:s}),s&&(p[h]=f)),this.resolvedOptions=function(){return u},this.format=f}var a=function(r){return r&&r.__esModule?r["default"]:r};r.exports=n;/*! | ||
!function(r){function t(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return r[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var e={};return t.m=r,t.c=e,t.p="/",t(0)}([function(r,t,e){r.exports=e(1)},function(r,t,e){"use strict";(window.Intl||(window.Intl={})).MessageFormat=e(6)},function(r,t,e){"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}t.__esModule=!0;var a=e(4),l=n(a),i={locales:{},formats:{cache:{},number:{currency:{style:"currency",currency:"USD"},percent:{style:"percent"}},date:{"short":{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},"long":{month:"long",day:"numeric",year:"numeric"},full:{month:"long",day:"numeric",year:"numeric",weekday:"long"}},time:{"short":{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},"long":{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}}};Object.keys(l["default"]).forEach(function(r){var t=l["default"][r],e=t.plural,n=t.ordinal;i.locales[r]={locale:r,plural:e,ordinal:n}}),t["default"]=i,r.exports=t["default"]},function(r,t){"use strict";function e(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var n=function(){function r(){var t=void 0===arguments[0]?{}:arguments[0],n=t.locale,a=t.data,l=t.formats,i=t.cache;e(this,r),this.originalLocale=n,this.localeData=a,this.formats=l,this.enableCache="boolean"==typeof i?i:!0}return r.prototype.interpret=function(r){return this.interpretSubs(r)},r.prototype.interpretSubs=function(r,t){var e=this;return r=r.map(function(r){return e.interpretElement(r,t)}),1===r.length?r[0]:function(t){for(var e="",n=0,a=r.length;a>n;++n)e+=r[n](t);return e}},r.prototype.interpretElement=function(r,t){if("string"==typeof r)return function(){return r};var e=r[0],n=r[1],a=r[2],l=0,i=void 0;switch("#"===e&&(e=t[0],n="selectordinal"===t[1]?"ordinal":"number",l=t[2],a=null),n){case"number":case"ordinal":case"spellout":case"duration":return this.interpretNumber(e,l,a);case"date":case"time":return this.interpretDateTime(e,n,a);case"plural":case"selectordinal":return l=r[2],i=r[3],this.interpretPlural(e,n,l,i);case"select":return this.interpretSelect(e,a);default:return this.interpretSimple(e)}},r.prototype.interpretNumber=function(r,t){var e=this,n=void 0===arguments[2]?"medium":arguments[2];t=t||0;var a=this.originalLocale,l=this.formats,i=l.cache,o=a+":number:"+n,u=void 0;return this.enableCache&&o in i?u=i[o]:!function(){var r=l.number[n];u="undefined"!=typeof Intl&&Intl.NumberFormat?new Intl.NumberFormat(a,r).format:function(t){return Number(t).toLocaleString(a,r)},e.enableCache&&(i[o]=u)}(),function(e){return u(+e[r]-t)}},r.prototype.interpretDateTime=function(r,t){var e=this,n=void 0===arguments[2]?"medium":arguments[2],a=this.originalLocale,l=this.formats,i=l.cache,o=a+":"+t+":"+n,u=void 0;return this.enableCache&&o in i?u=i[o]:!function(){var r=l[t][n],s="time"===t?"toLocaleTimeString":"toLocaleDateString";u="undefined"!=typeof Intl&&Intl.DateTimeFormat?new Intl.DateTimeFormat(a,r).format:function(t){return new Date(t)[s](a,r)},e.enableCache&&(i[o]=u)}(),function(t){return u(t[r])}},r.prototype.interpretPlural=function(r,t,e,n){var a=this,l="selectordinal"===t?this.localeData.ordinal:this.localeData.plural,i=[r,t,e],o={};return Object.keys(n).forEach(function(r){o[r]=a.interpretSubs(n[r],i)}),function(t){var n=+t[r],a="="+n,i=l?l(n-e):"other",u=o[a]||o[i]||o.other;return u(t)}},r.prototype.interpretSelect=function(r,t){var e=this,n={};return Object.keys(t).forEach(function(r){n[r]=e.interpretSubs(t[r],null)}),function(t){var e=t[r],a=n[e]||n.other;return a(t)}},r.prototype.interpretSimple=function(r){return function(t){return""+t[r]}},r.interpret=function(t,e){return new r(e).interpret(t)},r}();t["default"]=n,r.exports=t["default"]},function(r,t){"use strict";var e=[function(r){var t=+r;return 1===t?"one":"other"},function(r){var t=+r;return t>=0&&1>=t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===t||1===e?"one":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&10>=t%100?"few":t%100>=11&&99>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":"other"},function(r){var t=+r;return t%10===1&&t%100!==11?"one":t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":t%10===0||t%10>=5&&9>=t%10||t%100>=11&&14>=t%100?"many":"other"},function(){return"other"},function(r){var t=+r;return t%10===1&&t%100!==11&&t%100!==71&&t%100!==91?"one":t%10===2&&t%100!==12&&t%100!==72&&t%100!==92?"two":(t%10>=3&&4>=t%10||t%10===9)&&(10>t%100||t%100>19)&&(70>t%100||t%100>79)&&(90>t%100||t%100>99)?"few":0!==t&&t%1e6===0?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%10===1&&t%100!==11||n%10===1&&n%100!==11?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)||n%10>=2&&4>=n%10&&(12>n%100||n%100>14)?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":t>=2&&4>=t&&0===e?"few":0!==e?"many":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(""+r).replace(/^[^.]*.?|0+$/g,""),n=+r;return 1===n||0!==e&&(0===t||1===t)?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%100===1||n%100===1?"one":0===e&&t%100===2||n%100===2?"two":0===e&&t%100>=3&&4>=t%100||n%100>=3&&4>=n%100?"few":"other"},function(r){var t=Math.floor(Math.abs(+r));return 0===t||1===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&(1===t||2===t||3===t)||0===e&&t%10!==4&&t%10!==6&&t%10!==9||0!==e&&n%10!==4&&n%10!==6&&n%10!==9?"one":"other"},function(r){var t=+r;return 1===t?"one":2===t?"two":t>=3&&6>=t?"few":t>=7&&10>=t?"many":"other"},function(r){var t=+r;return 1===t||11===t?"one":2===t||12===t?"two":t>=3&&10>=t||t>=13&&19>=t?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%10===1?"one":0===e&&t%10===2?"two":0!==e||t%100!==0&&t%100!==20&&t%100!==40&&t%100!==60&&t%100!==80?0!==e?"many":"other":"few"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+r;return 1===t&&0===e?"one":2===t&&0===e?"two":0===e&&(0>n||n>10)&&n%10===0?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(""+r).replace(/^[^.]*.?|0+$/g,"");return 0===e&&t%10===1&&t%100!==11||0!==e?"one":"other"},function(r){var t=+r;return 1===t?"one":2===t?"two":"other"},function(r){var t=+r;return 0===t?"zero":1===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===e?"zero":0!==t&&1!==t||0===e?"other":"one"},function(r){var t=+(r+".").split(".")[1],e=+r;return e%10===1&&(11>e%100||e%100>19)?"one":e%10>=2&&9>=e%10&&(11>e%100||e%100>19)?"few":0!==t?"many":"other"},function(r){var t=(r+".").split(".")[1].length,e=+(r+".").split(".")[1],n=+r;return n%10===0||n%100>=11&&19>=n%100||2===t&&e%100>=11&&19>=e%100?"zero":n%10===1&&n%100!==11||2===t&&e%10===1&&e%100!==11||2!==t&&e%10===1?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+(r+".").split(".")[1];return 0===e&&t%10===1||n%10===1?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length,n=+r;return 1===t&&0===e?"one":0!==e||0===n||1!==n&&n%100>=1&&19>=n%100?"few":"other"},function(r){var t=+r;return 1===t?"one":0===t||t%100>=2&&10>=t%100?"few":t%100>=11&&19>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 1===t&&0===e?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":0===e&&1!==t&&t%10>=0&&1>=t%10||0===e&&t%10>=5&&9>=t%10||0===e&&t%100>=12&&14>=t%100?"many":"other"},function(r){var t=+r;return t>=0&&2>=t&&2!==t?"one":"other"},function(r){var t=(r+".").split(".")[1].length,e=+r;return 1===e&&0===t?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%10===1&&t%100!==11?"one":0===e&&t%10>=2&&4>=t%10&&(12>t%100||t%100>14)?"few":0===e&&t%10===0||0===e&&t%10>=5&&9>=t%10||0===e&&t%100>=11&&14>=t%100?"many":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+r;return 0===t||1===e?"one":e>=2&&10>=e?"few":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=+(r+".").split(".")[1],n=+r;return 0===n||1===n||0===t&&1===e?"one":"other"},function(r){var t=Math.floor(Math.abs(+r)),e=(r+".").split(".")[1].length;return 0===e&&t%100===1?"one":0===e&&t%100===2?"two":0===e&&t%100>=3&&4>=t%100||0!==e?"few":"other"},function(r){var t=+r;return t>=0&&1>=t||t>=11&&99>=t?"one":"other"},function(r){var t=+r;return 1===t||5===t||7===t||8===t||9===t||10===t?"one":2===t||3===t?"two":4===t?"few":6===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return t%10===1||t%10===2||t%10===5||t%10===7||t%10===8||t%100===20||t%100===50||t%100===70||t%100===80?"one":t%10===3||t%10===4||t%1e3===100||t%1e3===200||t%1e3===300||t%1e3===400||t%1e3===500||t%1e3===600||t%1e3===700||t%1e3===800||t%1e3===900?"few":0===t||t%10===6||t%100===40||t%100===60||t%100===90?"many":"other"},function(r){var t=+r;return 1===t||3===t?"one":2===t?"two":4===t?"few":"other"},function(r){var t=+r;return 0===t||7===t||8===t||9===t?"zero":1===t?"one":2===t?"two":3===t||4===t?"few":5===t||6===t?"many":"other"},function(r){var t=+r;return t%10===1&&t%100!==11?"one":t%10===2&&t%100!==12?"two":t%10===3&&t%100!==13?"few":"other"},function(r){var t=+r;return 1===t?"one":2===t||3===t?"two":4===t?"few":6===t?"many":"other"},function(r){var t=+r;return 1===t||5===t?"one":"other"},function(r){var t=+r;return 11===t||8===t||80===t||800===t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return 1===t?"one":0===t||t%100>=2&&20>=t%100||t%100===40||t%100===60||t%100===80?"many":"other"},function(r){var t=+r;return t%10===6||t%10===9||t%10===0&&0!==t?"many":"other"},function(r){var t=Math.floor(Math.abs(+r));return t%10===1&&t%100!==11?"one":t%10===2&&t%100!==12?"two":t%10!==7&&t%10!==8||t%100===17||t%100===18?"other":"many"},function(r){var t=+r;return 1===t?"one":2===t||3===t?"two":4===t?"few":"other"},function(r){var t=+r;return t>=1&&4>=t?"one":"other"},function(r){var t=+r;return 1===t?"one":t%10===4&&t%100!==14?"many":"other"},function(r){var t=+r;return t%10!==1&&t%10!==2||t%100===11||t%100===12?"other":"one"},function(r){var t=+r;return t%10===3&&t%100!==13?"few":"other"}];r.exports={af:{plural:e[0],ordinal:e[6]},ak:{plural:e[1]},am:{plural:e[2],ordinal:e[6]},ar:{plural:e[3],ordinal:e[6]},as:{plural:e[2],ordinal:e[36]},asa:{plural:e[0]},ast:{plural:e[4]},az:{plural:e[0],ordinal:e[37]},be:{plural:e[5]},bem:{plural:e[0]},bez:{plural:e[0]},bg:{plural:e[0],ordinal:e[6]},bh:{plural:e[1]},bm:{plural:e[6]},bn:{plural:e[2],ordinal:e[36]},bo:{plural:e[6]},br:{plural:e[7]},brx:{plural:e[0]},bs:{plural:e[8],ordinal:e[6]},ca:{plural:e[4],ordinal:e[38]},ce:{plural:e[0],ordinal:e[6]},cgg:{plural:e[0]},chr:{plural:e[0]},ckb:{plural:e[0]},cs:{plural:e[9],ordinal:e[6]},cy:{plural:e[10],ordinal:e[39]},da:{plural:e[11],ordinal:e[6]},de:{plural:e[4],ordinal:e[6]},dsb:{plural:e[12],ordinal:e[6]},dv:{plural:e[0]},dz:{plural:e[6]},ee:{plural:e[0]},el:{plural:e[0],ordinal:e[6]},en:{plural:e[4],ordinal:e[40]},eo:{plural:e[0]},es:{plural:e[0],ordinal:e[6]},et:{plural:e[4],ordinal:e[6]},eu:{plural:e[0],ordinal:e[6]},fa:{plural:e[2],ordinal:e[6]},ff:{plural:e[13]},fi:{plural:e[4],ordinal:e[6]},fil:{plural:e[14],ordinal:e[0]},fo:{plural:e[0]},fr:{plural:e[13],ordinal:e[0]},fur:{plural:e[0]},fy:{plural:e[4],ordinal:e[6]},ga:{plural:e[15]},gd:{plural:e[16]},gl:{plural:e[4],ordinal:e[6]},gsw:{plural:e[0]},gu:{plural:e[2],ordinal:e[41]},guw:{plural:e[1]},gv:{plural:e[17]},ha:{plural:e[0]},haw:{plural:e[0]},he:{plural:e[18],ordinal:e[6]},hi:{plural:e[2],ordinal:e[41]},hr:{plural:e[8],ordinal:e[6]},hsb:{plural:e[12],ordinal:e[6]},hu:{plural:e[0],ordinal:e[42]},hy:{plural:e[13],ordinal:e[0]},id:{plural:e[6],ordinal:e[6]},ig:{plural:e[6]},ii:{plural:e[6]},"in":{plural:e[6],ordinal:e[6]},is:{plural:e[19],ordinal:e[6]},it:{plural:e[4],ordinal:e[43]},iu:{plural:e[20]},iw:{plural:e[18],ordinal:e[6]},ja:{plural:e[6],ordinal:e[6]},jbo:{plural:e[6]},jgo:{plural:e[0]},ji:{plural:e[4]},jmc:{plural:e[0]},jv:{plural:e[6]},jw:{plural:e[6]},ka:{plural:e[0],ordinal:e[44]},kab:{plural:e[13]},kaj:{plural:e[0]},kcg:{plural:e[0]},kde:{plural:e[6]},kea:{plural:e[6]},kk:{plural:e[0],ordinal:e[45]},kkj:{plural:e[0]},kl:{plural:e[0]},km:{plural:e[6],ordinal:e[6]},kn:{plural:e[2],ordinal:e[6]},ko:{plural:e[6],ordinal:e[6]},ks:{plural:e[0]},ksb:{plural:e[0]},ksh:{plural:e[21]},ku:{plural:e[0]},kw:{plural:e[20]},ky:{plural:e[0],ordinal:e[6]},lag:{plural:e[22]},lb:{plural:e[0]},lg:{plural:e[0]},lkt:{plural:e[6]},ln:{plural:e[1]},lo:{plural:e[6],ordinal:e[0]},lt:{plural:e[23],ordinal:e[6]},lv:{plural:e[24],ordinal:e[6]},mas:{plural:e[0]},mg:{plural:e[1]},mgo:{plural:e[0]},mk:{plural:e[25],ordinal:e[46]},ml:{plural:e[0],ordinal:e[6]},mn:{plural:e[0],ordinal:e[6]},mo:{plural:e[26],ordinal:e[0]},mr:{plural:e[2],ordinal:e[47]},ms:{plural:e[6],ordinal:e[0]},mt:{plural:e[27]},my:{plural:e[6],ordinal:e[6]},nah:{plural:e[0]},naq:{plural:e[20]},nb:{plural:e[0],ordinal:e[6]},nd:{plural:e[0]},ne:{plural:e[0],ordinal:e[48]},nl:{plural:e[4],ordinal:e[6]},nn:{plural:e[0]},nnh:{plural:e[0]},no:{plural:e[0]},nqo:{plural:e[6]},nr:{plural:e[0]},nso:{plural:e[1]},ny:{plural:e[0]},nyn:{plural:e[0]},om:{plural:e[0]},or:{plural:e[0]},os:{plural:e[0]},pa:{plural:e[1],ordinal:e[6]},pap:{plural:e[0]},pl:{plural:e[28],ordinal:e[6]},prg:{plural:e[24],ordinal:e[6]},ps:{plural:e[0]},pt:{plural:e[29],ordinal:e[6]},"pt-PT":{plural:e[30]},rm:{plural:e[0]},ro:{plural:e[26],ordinal:e[0]},rof:{plural:e[0]},root:{plural:e[6],ordinal:e[6]},ru:{plural:e[31],ordinal:e[6]},rwk:{plural:e[0]},sah:{plural:e[6]},saq:{plural:e[0]},se:{plural:e[20]},seh:{plural:e[0]},ses:{plural:e[6]},sg:{plural:e[6]},sh:{plural:e[8],ordinal:e[6]},shi:{plural:e[32]},si:{plural:e[33],ordinal:e[6]},sk:{plural:e[9],ordinal:e[6]},sl:{plural:e[34],ordinal:e[6]},sma:{plural:e[20]},smi:{plural:e[20]},smj:{plural:e[20]},smn:{plural:e[20]},sms:{plural:e[20]},sn:{plural:e[0]},so:{plural:e[0]},sq:{plural:e[0],ordinal:e[49]},sr:{plural:e[8],ordinal:e[6]},ss:{plural:e[0]},ssy:{plural:e[0]},st:{plural:e[0]},sv:{plural:e[4],ordinal:e[50]},sw:{plural:e[4],ordinal:e[6]},syr:{plural:e[0]},ta:{plural:e[0],ordinal:e[6]},te:{plural:e[0],ordinal:e[6]},teo:{plural:e[0]},th:{plural:e[6],ordinal:e[6]},ti:{plural:e[1]},tig:{plural:e[0]},tk:{plural:e[0]},tl:{plural:e[14],ordinal:e[0]},tn:{plural:e[0]},to:{plural:e[6]},tr:{plural:e[0],ordinal:e[6]},ts:{plural:e[0]},tzm:{plural:e[35]},ug:{plural:e[0]},uk:{plural:e[31],ordinal:e[51]},ur:{plural:e[4],ordinal:e[6]},uz:{plural:e[0],ordinal:e[6]},ve:{plural:e[0]},vi:{plural:e[6],ordinal:e[0]},vo:{plural:e[0]},vun:{plural:e[0]},wa:{plural:e[1]},wae:{plural:e[0]},wo:{plural:e[6]},xh:{plural:e[0]},xog:{plural:e[0]},yi:{plural:e[4]},yo:{plural:e[6]},zh:{plural:e[6],ordinal:e[6]},zu:{plural:e[2],ordinal:e[6]}}},function(r,t){"use strict";function e(r,t){for(var e=[].concat(r||[]),n=0,a=e.length;a>n;++n)for(var l=e[n].split("-");l.length;){if(l.join("-")in t)return l.join("-");l.pop()}return"en"}t.__esModule=!0,t["default"]=e,r.exports=t["default"]},function(r,t,e){/*! | ||
* Intl.MessageFormat polyfill | ||
@@ -6,3 +6,3 @@ * Copyright(c) 2015 Andy VanWagoner | ||
**/ | ||
var l=a(e(7)),i=a(e(3)),o=a(e(5)),u=a(e(2));Object.defineProperties(n.prototype,{resolvedOptions:{configurable:!0,writable:!0,value:function(){}},format:{configurable:!0,writable:!0,value:function(){}}}),Object.defineProperties(n,{supportedLocalesOf:{configurable:!0,writable:!0,value:function(){return Object.keys(n.data.locales)}},data:{value:u}})},function(r){"use strict";var t=function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.__proto__=t)},e=function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function r(){var t=void 0===arguments[0]?{}:arguments[0],n=t.escape;e(this,r),this.escape=n||"'",this.pattern=null,this.index=0}return r.prototype.parse=function(r){return this.pattern=r,this.index=0,this.parseMessage("message")},r.prototype.isDigit=function(r){return"0"===r||"1"===r||"2"===r||"3"===r||"4"===r||"5"===r||"6"===r||"7"===r||"8"===r||"9"===r},r.prototype.isWhitespace=function(r){return" "===r||" "===r||"\n"===r||"\r"===r||"\f"===r||""===r||" "===r||"\u2028"===r||"\u2029"===r},r.prototype.skipWhitespace=function(){for(var r=this.pattern,t=r.length;this.index<t&&this.isWhitespace(r.charAt(this.index));)++this.index},r.prototype.parseText=function(r){for(var t=this.pattern,e=t.length,n="plural"===r||"selectordinal"===r,a="style"===r,l=this.escape,i="",o=void 0;this.index<e&&(o=t.charAt(this.index),!("{"===o||"}"===o||n&&"#"===o||a&&this.isWhitespace(o)));)if("'"===l&&"'"===o)if(o=t.charAt(++this.index),"'"===o)i+=o,++this.index;else if("{"===o||"}"===o||n&&"#"===o||a&&this.isWhitespace(o))for(i+=o;++this.index<e;)if(o=t.charAt(this.index),"''"===t.slice(this.index,this.index+2))i+=o,++this.index;else{if("'"===o){++this.index;break}i+=o}else i+="'";else l&&l===o?(o=t.charAt(++this.index),i+=o,++this.index):(i+=o,++this.index);return i},r.prototype.parseArgument=function(){var r=this.pattern;if("#"===r.charAt(this.index))return++this.index,["#"];++this.index;var t=this.parseArgId(),e=r.charAt(this.index);if("}"===e)return++this.index,[t];","!==e&&this.throwExpected(","),++this.index;var n=this.parseArgType();if(e=r.charAt(this.index),"}"===e)return("plural"===n||"selectordinal"===n||"select"===n)&&this.throwExpected(n+" message options"),++this.index,[t,n];","!==e&&this.throwExpected(","),++this.index;var a=void 0,l=void 0;return"plural"===n||"selectordinal"===n?(l=this.parsePluralOffset(),a=this.parseSubMessages(n)):a="select"===n?this.parseSubMessages(n):this.parseSimpleFormat(),e=r.charAt(this.index),"}"!==e&&this.throwExpected("}"),++this.index,"plural"===n||"selectordinal"===n?[t,n,l,a]:[t,n,a]},r.prototype.parseArgId=function(){this.skipWhitespace();for(var r=this.pattern,t=r.length,e="";this.index<t;){var n=r.charAt(this.index);if(("{"===n||"#"===n)&&this.throwExpected("argument id"),"}"===n||","===n||this.isWhitespace(n))break;e+=n,++this.index}return e||this.throwExpected("argument id"),this.skipWhitespace(),e},r.prototype.parseArgType=function(){this.skipWhitespace();for(var r=this.pattern,t=void 0,e=["number","date","time","ordinal","duration","spellout","plural","selectordinal","select"],n=0,a=e.length;a>n;++n){var l=e[n];if(r.slice(this.index,this.index+l.length)===l){t=l,this.index+=l.length;break}}return t||this.throwExpected(e.join(", ")),this.skipWhitespace(),t},r.prototype.parseSimpleFormat=function(){this.skipWhitespace();var r=this.parseText("style");return r||this.throwExpected("argument style name"),this.skipWhitespace(),r},r.prototype.parsePluralOffset=function(){this.skipWhitespace();var r=0,t=this.pattern,e=t.length;if("offset:"===t.slice(this.index,this.index+7)){this.index+=7,this.skipWhitespace();for(var n=this.index;this.index<e&&this.isDigit(t.charAt(this.index));)++this.index;n===this.index&&this.throwExpected("offset number"),r=+t.slice(n,this.index),this.skipWhitespace()}return r},r.prototype.parseSubMessages=function(r){this.skipWhitespace();for(var t=this.pattern,e=t.length,n={},a=!1;this.index<e&&"}"!==t.charAt(this.index);){var l=this.parseSelector();this.skipWhitespace(),n[l]=this.parseSubMessage(r),a=!0,this.skipWhitespace()}return a||this.throwExpected(r+" message options"),"other"in n||this.throwExpected(null,null,'"other" option must be specified in '+r),n},r.prototype.parseSelector=function(){for(var r=this.pattern,t=r.length,e="";this.index<t;){var n=r.charAt(this.index);if(("}"===n||","===n)&&this.throwExpected("{"),"{"===n||this.isWhitespace(n))break;e+=n,++this.index}return e||this.throwExpected("selector"),this.skipWhitespace(),e},r.prototype.parseSubMessage=function(r){var t=this.pattern.charAt(this.index);"{"!==t&&this.throwExpected("{"),++this.index;var e=this.parseMessage(r);return t=this.pattern.charAt(this.index),"}"!==t&&this.throwExpected("}"),++this.index,e},r.prototype.parseMessage=function(r){var t=this.pattern,e=t.length,n=void 0,a=[];for((n=this.parseText(r))&&a.push(n);this.index<e;){if("}"===t.charAt(this.index)){"message"===r&&this.throwExpected();break}a.push(this.parseArgument(r)),(n=this.parseText(r))&&a.push(n)}return a},r.prototype.throwExpected=function(r,t,e){var n=this.pattern,l=n.slice(0,this.index).split(/\r?\n/),i=this.index,o=l.length,u=l.slice(-1)[0].length;throw t||(t=this.pattern.charAt(this.index)||"end of input"),e||(e=this.errorMessage(r,t)),e+=" in "+n.replace(/\r?\n/g,"\n"),new a(e,r,t,i,o,u)},r.prototype.errorMessage=function(r,t){return r?"Expected "+r+" but "+t+" found":"Unexpected "+t+" found"},r.parse=function(t,e){return new r(e).parse(t)},r}();r.exports=n;var a=function(r){function n(r,t,a,l,i,o){e(this,n),this.name="SyntaxError",this.message=r,this.expected=t,this.found=a,this.offset=l,this.line=i,this.column=o}return t(n,r),n}(Error);n.SyntaxError=a}]); | ||
"use strict";function n(r){return r&&r.__esModule?r:{"default":r}}function a(r,t){var e=void 0===arguments[2]?{}:arguments[2];if("object"!=typeof this||!(this instanceof a))return new a(r,t,e);if("string"!=typeof r)throw new TypeError("message pattern must be a string");var n=p["default"](t,a.data.locales),l=a.data.locales[n],o="cache"in e?e.cache:!0,s=a.data.formats.cache,h=n+":message:"+r,c=a.data.formats,f=void 0;o&&h in s?f=s[h]:(f=u["default"].interpret(i["default"].parse(r,{escape:e.escape}),{locale:t,data:l,formats:c,cache:o}),o&&(s[h]=f)),this.resolvedOptions=function(){return l},this.format=f}t.__esModule=!0,t["default"]=a;var l=e(7),i=n(l),o=e(3),u=n(o),s=e(5),p=n(s),h=e(2),c=n(h);Object.defineProperties(a.prototype,{resolvedOptions:{configurable:!0,writable:!0,value:function(){}},format:{configurable:!0,writable:!0,value:function(){}}}),Object.defineProperties(a,{supportedLocalesOf:{configurable:!0,writable:!0,value:function(){return Object.keys(a.data.locales)}},data:{value:c["default"]}}),r.exports=t["default"]},function(r,t){"use strict";function e(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t&&(r.__proto__=t)}function n(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var a=function(){function r(){var t=void 0===arguments[0]?{}:arguments[0],e=t.escape;n(this,r),this.escape=e||"'",this.pattern=null,this.index=0}return r.prototype.parse=function(r){return this.pattern=r,this.index=0,this.parseMessage("message")},r.prototype.isDigit=function(r){return"0"===r||"1"===r||"2"===r||"3"===r||"4"===r||"5"===r||"6"===r||"7"===r||"8"===r||"9"===r},r.prototype.isWhitespace=function(r){return" "===r||" "===r||"\n"===r||"\r"===r||"\f"===r||""===r||" "===r||"\u2028"===r||"\u2029"===r},r.prototype.skipWhitespace=function(){for(var r=this.pattern,t=r.length;this.index<t&&this.isWhitespace(r.charAt(this.index));)++this.index},r.prototype.parseText=function(r){for(var t=this.pattern,e=t.length,n="plural"===r||"selectordinal"===r,a="style"===r,l=this.escape,i="",o=void 0;this.index<e&&(o=t.charAt(this.index),!("{"===o||"}"===o||n&&"#"===o||a&&this.isWhitespace(o)));)if("'"===l&&"'"===o)if(o=t.charAt(++this.index),"'"===o)i+=o,++this.index;else if("{"===o||"}"===o||n&&"#"===o||a&&this.isWhitespace(o))for(i+=o;++this.index<e;)if(o=t.charAt(this.index),"''"===t.slice(this.index,this.index+2))i+=o,++this.index;else{if("'"===o){++this.index;break}i+=o}else i+="'";else l&&l===o?(o=t.charAt(++this.index),i+=o,++this.index):(i+=o,++this.index);return i},r.prototype.parseArgument=function(){var r=this.pattern;if("#"===r.charAt(this.index))return++this.index,["#"];++this.index;var t=this.parseArgId(),e=r.charAt(this.index);if("}"===e)return++this.index,[t];","!==e&&this.throwExpected(","),++this.index;var n=this.parseArgType();if(e=r.charAt(this.index),"}"===e)return("plural"===n||"selectordinal"===n||"select"===n)&&this.throwExpected(n+" message options"),++this.index,[t,n];","!==e&&this.throwExpected(","),++this.index;var a=void 0,l=void 0;return"plural"===n||"selectordinal"===n?(l=this.parsePluralOffset(),a=this.parseSubMessages(n)):a="select"===n?this.parseSubMessages(n):this.parseSimpleFormat(),e=r.charAt(this.index),"}"!==e&&this.throwExpected("}"),++this.index,"plural"===n||"selectordinal"===n?[t,n,l,a]:[t,n,a]},r.prototype.parseArgId=function(){this.skipWhitespace();for(var r=this.pattern,t=r.length,e="";this.index<t;){var n=r.charAt(this.index);if(("{"===n||"#"===n)&&this.throwExpected("argument id"),"}"===n||","===n||this.isWhitespace(n))break;e+=n,++this.index}return e||this.throwExpected("argument id"),this.skipWhitespace(),e},r.prototype.parseArgType=function(){this.skipWhitespace();for(var r=this.pattern,t=void 0,e=["number","date","time","ordinal","duration","spellout","plural","selectordinal","select"],n=0,a=e.length;a>n;++n){var l=e[n];if(r.slice(this.index,this.index+l.length)===l){t=l,this.index+=l.length;break}}return t||this.throwExpected(e.join(", ")),this.skipWhitespace(),t},r.prototype.parseSimpleFormat=function(){this.skipWhitespace();var r=this.parseText("style");return r||this.throwExpected("argument style name"),this.skipWhitespace(),r},r.prototype.parsePluralOffset=function(){this.skipWhitespace();var r=0,t=this.pattern,e=t.length;if("offset:"===t.slice(this.index,this.index+7)){this.index+=7,this.skipWhitespace();for(var n=this.index;this.index<e&&this.isDigit(t.charAt(this.index));)++this.index;n===this.index&&this.throwExpected("offset number"),r=+t.slice(n,this.index),this.skipWhitespace()}return r},r.prototype.parseSubMessages=function(r){this.skipWhitespace();for(var t=this.pattern,e=t.length,n={},a=!1;this.index<e&&"}"!==t.charAt(this.index);){var l=this.parseSelector();this.skipWhitespace(),n[l]=this.parseSubMessage(r),a=!0,this.skipWhitespace()}return a||this.throwExpected(r+" message options"),"other"in n||this.throwExpected(null,null,'"other" option must be specified in '+r),n},r.prototype.parseSelector=function(){for(var r=this.pattern,t=r.length,e="";this.index<t;){var n=r.charAt(this.index);if(("}"===n||","===n)&&this.throwExpected("{"),"{"===n||this.isWhitespace(n))break;e+=n,++this.index}return e||this.throwExpected("selector"),this.skipWhitespace(),e},r.prototype.parseSubMessage=function(r){var t=this.pattern.charAt(this.index);"{"!==t&&this.throwExpected("{"),++this.index;var e=this.parseMessage(r);return t=this.pattern.charAt(this.index),"}"!==t&&this.throwExpected("}"),++this.index,e},r.prototype.parseMessage=function(r){var t=this.pattern,e=t.length,n=void 0,a=[];for((n=this.parseText(r))&&a.push(n);this.index<e;){if("}"===t.charAt(this.index)){"message"===r&&this.throwExpected();break}a.push(this.parseArgument(r)),(n=this.parseText(r))&&a.push(n)}return a},r.prototype.throwExpected=function(r,t,e){var n=this.pattern,a=n.slice(0,this.index).split(/\r?\n/),i=this.index,o=a.length,u=a.slice(-1)[0].length;throw t||(t=this.pattern.charAt(this.index)||"end of input"),e||(e=this.errorMessage(r,t)),e+=" in "+n.replace(/\r?\n/g,"\n"),new l(e,r,t,i,o,u)},r.prototype.errorMessage=function(r,t){return r?"Expected "+r+" but "+t+" found":"Unexpected "+t+" found"},r.parse=function(t,e){return new r(e).parse(t)},r}();t["default"]=a;var l=function(r){function t(e,a,l,i,o,u){n(this,t),r.call(this,e),this.name="SyntaxError",this.message=e,this.expected=a,this.found=l,this.offset=i,this.line=o,this.column=u}return e(t,r),t}(Error);a.SyntaxError=l,r.exports=t["default"]}]); | ||
//# sourceMappingURL=browser.js.map |
@@ -1,7 +0,11 @@ | ||
"use strict"; | ||
'use strict'; | ||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; | ||
exports.__esModule = true; | ||
var locales = _interopRequire(require("./locales")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var _locales = require('./locales'); | ||
var _locales2 = _interopRequireDefault(_locales); | ||
/** | ||
@@ -16,7 +20,7 @@ * locale data and formatting information | ||
currency: { | ||
style: "currency", | ||
currency: "USD" | ||
style: 'currency', | ||
currency: 'USD' | ||
}, | ||
percent: { | ||
style: "percent" | ||
style: 'percent' | ||
} | ||
@@ -26,21 +30,21 @@ }, | ||
short: { | ||
month: "numeric", | ||
day: "numeric", | ||
year: "2-digit" | ||
month: 'numeric', | ||
day: 'numeric', | ||
year: '2-digit' | ||
}, | ||
medium: { | ||
month: "short", | ||
day: "numeric", | ||
year: "numeric" | ||
month: 'short', | ||
day: 'numeric', | ||
year: 'numeric' | ||
}, | ||
long: { | ||
month: "long", | ||
day: "numeric", | ||
year: "numeric" | ||
month: 'long', | ||
day: 'numeric', | ||
year: 'numeric' | ||
}, | ||
full: { | ||
month: "long", | ||
day: "numeric", | ||
year: "numeric", | ||
weekday: "long" | ||
month: 'long', | ||
day: 'numeric', | ||
year: 'numeric', | ||
weekday: 'long' | ||
} | ||
@@ -50,21 +54,21 @@ }, | ||
short: { | ||
hour: "numeric", | ||
minute: "numeric" | ||
hour: 'numeric', | ||
minute: 'numeric' | ||
}, | ||
medium: { | ||
hour: "numeric", | ||
minute: "numeric", | ||
second: "numeric" | ||
hour: 'numeric', | ||
minute: 'numeric', | ||
second: 'numeric' | ||
}, | ||
long: { | ||
hour: "numeric", | ||
minute: "numeric", | ||
second: "numeric", | ||
timeZoneName: "short" | ||
hour: 'numeric', | ||
minute: 'numeric', | ||
second: 'numeric', | ||
timeZoneName: 'short' | ||
}, | ||
full: { | ||
hour: "numeric", | ||
minute: "numeric", | ||
second: "numeric", | ||
timeZoneName: "short" | ||
hour: 'numeric', | ||
minute: 'numeric', | ||
second: 'numeric', | ||
timeZoneName: 'short' | ||
} | ||
@@ -75,4 +79,4 @@ } | ||
Object.keys(locales).forEach(function (locale) { | ||
var _locales$locale = locales[locale]; | ||
Object.keys(_locales2['default']).forEach(function (locale) { | ||
var _locales$locale = _locales2['default'][locale]; | ||
var plural = _locales$locale.plural; | ||
@@ -86,2 +90,3 @@ var ordinal = _locales$locale.ordinal; | ||
module.exports = data; | ||
exports['default'] = data; | ||
module.exports = exports['default']; |
@@ -1,5 +0,2 @@ | ||
"use strict"; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; | ||
/*globals Intl*/ | ||
/** | ||
@@ -19,3 +16,8 @@ * Interpretr | ||
**/ | ||
'use strict'; | ||
exports.__esModule = true; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var Interpreter = (function () { | ||
@@ -35,3 +37,3 @@ function Interpreter() { | ||
this.formats = formats; | ||
this.enableCache = typeof cache === "boolean" ? cache : true; | ||
this.enableCache = typeof cache === 'boolean' ? cache : true; | ||
} | ||
@@ -56,3 +58,3 @@ | ||
return function format(args) { | ||
var message = ""; | ||
var message = ''; | ||
for (var e = 0, ee = elements.length; e < ee; ++e) { | ||
@@ -66,3 +68,3 @@ message += elements[e](args); | ||
Interpreter.prototype.interpretElement = function interpretElement(element, parent) { | ||
if (typeof element === "string") { | ||
if (typeof element === 'string') { | ||
return function format() { | ||
@@ -79,5 +81,5 @@ return element; | ||
if (id === "#") { | ||
if (id === '#') { | ||
id = parent[0]; | ||
type = parent[1] === "selectordinal" ? "ordinal" : "number"; | ||
type = parent[1] === 'selectordinal' ? 'ordinal' : 'number'; | ||
offset = parent[2]; | ||
@@ -88,17 +90,17 @@ style = null; | ||
switch (type) { | ||
case "number": | ||
case "ordinal": // TODO: rbnf | ||
case "spellout": // TODO: rbnf | ||
case "duration": | ||
case 'number': | ||
case 'ordinal': // TODO: rbnf | ||
case 'spellout': // TODO: rbnf | ||
case 'duration': | ||
// TODO: duration | ||
return this.interpretNumber(id, offset, style); | ||
case "date": | ||
case "time": | ||
case 'date': | ||
case 'time': | ||
return this.interpretDateTime(id, type, style); | ||
case "plural": | ||
case "selectordinal": | ||
case 'plural': | ||
case 'selectordinal': | ||
offset = element[2]; | ||
options = element[3]; | ||
return this.interpretPlural(id, type, offset, options); | ||
case "select": | ||
case 'select': | ||
return this.interpretSelect(id, style); | ||
@@ -111,5 +113,5 @@ default: | ||
Interpreter.prototype.interpretNumber = function interpretNumber(id, offset) { | ||
var _this = this; | ||
var _this2 = this; | ||
var style = arguments[2] === undefined ? "medium" : arguments[2]; | ||
var style = arguments[2] === undefined ? 'medium' : arguments[2]; | ||
@@ -120,3 +122,3 @@ offset = offset || 0; | ||
var cache = formats.cache; | ||
var key = locale + ":number:" + style; | ||
var key = locale + ':number:' + style; | ||
var func = undefined; | ||
@@ -128,6 +130,6 @@ if (this.enableCache && key in cache) { | ||
var options = formats.number[style]; | ||
func = typeof Intl !== "undefined" && Intl.NumberFormat ? new Intl.NumberFormat(locale, options).format : function (arg) { | ||
func = typeof Intl !== 'undefined' && Intl.NumberFormat ? new Intl.NumberFormat(locale, options).format : function (arg) { | ||
return Number(arg).toLocaleString(locale, options); | ||
}; | ||
if (_this.enableCache) { | ||
if (_this2.enableCache) { | ||
cache[key] = func; | ||
@@ -143,5 +145,5 @@ } | ||
Interpreter.prototype.interpretDateTime = function interpretDateTime(id, type) { | ||
var _this = this; | ||
var _this3 = this; | ||
var style = arguments[2] === undefined ? "medium" : arguments[2]; | ||
var style = arguments[2] === undefined ? 'medium' : arguments[2]; | ||
@@ -151,3 +153,3 @@ var locale = this.originalLocale; | ||
var cache = formats.cache; | ||
var key = locale + ":" + type + ":" + style; | ||
var key = locale + ':' + type + ':' + style; | ||
var func = undefined; | ||
@@ -159,7 +161,7 @@ if (this.enableCache && key in cache) { | ||
var options = formats[type][style]; | ||
var toLocaleString = type === "time" ? "toLocaleTimeString" : "toLocaleDateString"; | ||
func = typeof Intl !== "undefined" && Intl.DateTimeFormat ? new Intl.DateTimeFormat(locale, options).format : function (arg) { | ||
var toLocaleString = type === 'time' ? 'toLocaleTimeString' : 'toLocaleDateString'; | ||
func = typeof Intl !== 'undefined' && Intl.DateTimeFormat ? new Intl.DateTimeFormat(locale, options).format : function (arg) { | ||
return new Date(arg)[toLocaleString](locale, options); | ||
}; | ||
if (_this.enableCache) { | ||
if (_this3.enableCache) { | ||
cache[key] = func; | ||
@@ -175,14 +177,14 @@ } | ||
Interpreter.prototype.interpretPlural = function interpretPlural(id, type, offset, children) { | ||
var _this = this; | ||
var _this4 = this; | ||
var plural = type === "selectordinal" ? this.localeData.ordinal : this.localeData.plural; | ||
var plural = type === 'selectordinal' ? this.localeData.ordinal : this.localeData.plural; | ||
var parent = [id, type, offset /*, children*/]; | ||
var options = {}; | ||
Object.keys(children).forEach(function (key) { | ||
options[key] = _this.interpretSubs(children[key], parent); | ||
options[key] = _this4.interpretSubs(children[key], parent); | ||
}); | ||
return function format(args) { | ||
var arg = +args[id]; | ||
var exactSelector = "=" + arg; | ||
var keywordSelector = plural ? plural(arg - offset) : "other"; | ||
var exactSelector = '=' + arg; | ||
var keywordSelector = plural ? plural(arg - offset) : 'other'; | ||
var func = options[exactSelector] || options[keywordSelector] || options.other; | ||
@@ -194,7 +196,7 @@ return func(args); | ||
Interpreter.prototype.interpretSelect = function interpretSelect(id, children) { | ||
var _this = this; | ||
var _this5 = this; | ||
var options = {}; | ||
Object.keys(children).forEach(function (key) { | ||
options[key] = _this.interpretSubs(children[key], null); | ||
options[key] = _this5.interpretSubs(children[key], null); | ||
}); | ||
@@ -210,3 +212,3 @@ return function format(args) { | ||
return function format(args) { | ||
return "" + args[id]; | ||
return '' + args[id]; | ||
}; | ||
@@ -222,2 +224,3 @@ }; | ||
module.exports = Interpreter; | ||
exports['default'] = Interpreter; | ||
module.exports = exports['default']; |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -6,9 +6,9 @@ var p = [function (s) { | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
return "other"; | ||
if (n === 1) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 0..1 | ||
if (n >= 0 && n <= 1) return "one"; | ||
return "other"; | ||
if (n >= 0 && n <= 1) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
@@ -18,170 +18,170 @@ var i = Math.floor(Math.abs(+s)); | ||
// i = 0 or n = 1 | ||
if (i === 0 || n === 1) return "one"; | ||
return "other"; | ||
if (i === 0 || n === 1) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 0 | ||
if (n === 0) return "zero"; | ||
if (n === 0) return 'zero'; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n = 2 | ||
if (n === 2) return "two"; | ||
if (n === 2) return 'two'; | ||
// n % 100 = 3..10 | ||
if (n % 100 >= 3 && n % 100 <= 10) return "few"; | ||
if (n % 100 >= 3 && n % 100 <= 10) return 'few'; | ||
// n % 100 = 11..99 | ||
if (n % 100 >= 11 && n % 100 <= 99) return "many"; | ||
return "other"; | ||
if (n % 100 >= 11 && n % 100 <= 99) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
// i = 1 and v = 0 | ||
if (i === 1 && v === 0) return "one"; | ||
return "other"; | ||
if (i === 1 && v === 0) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n % 10 = 1 and n % 100 != 11 | ||
if (n % 10 === 1 && n % 100 !== 11) return "one"; | ||
if (n % 10 === 1 && n % 100 !== 11) return 'one'; | ||
// n % 10 = 2..4 and n % 100 != 12..14 | ||
if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) return "few"; | ||
if (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14)) return 'few'; | ||
// n % 10 = 0 or n % 10 = 5..9 or n % 100 = 11..14 | ||
if (n % 10 === 0 || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 11 && n % 100 <= 14) return "many"; | ||
return "other"; | ||
if (n % 10 === 0 || n % 10 >= 5 && n % 10 <= 9 || n % 100 >= 11 && n % 100 <= 14) return 'many'; | ||
return 'other'; | ||
}, function () { | ||
return "other"; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n % 10 = 1 and n % 100 != 11,71,91 | ||
if (n % 10 === 1 && (n % 100 !== 11 && n % 100 !== 71 && n % 100 !== 91)) return "one"; | ||
if (n % 10 === 1 && (n % 100 !== 11 && n % 100 !== 71 && n % 100 !== 91)) return 'one'; | ||
// n % 10 = 2 and n % 100 != 12,72,92 | ||
if (n % 10 === 2 && (n % 100 !== 12 && n % 100 !== 72 && n % 100 !== 92)) return "two"; | ||
if (n % 10 === 2 && (n % 100 !== 12 && n % 100 !== 72 && n % 100 !== 92)) return 'two'; | ||
// n % 10 = 3..4,9 and n % 100 != 10..19,70..79,90..99 | ||
if ((n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) && ((n % 100 < 10 || n % 100 > 19) && (n % 100 < 70 || n % 100 > 79) && (n % 100 < 90 || n % 100 > 99))) return "few"; | ||
if ((n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) && ((n % 100 < 10 || n % 100 > 19) && (n % 100 < 70 || n % 100 > 79) && (n % 100 < 90 || n % 100 > 99))) return 'few'; | ||
// n != 0 and n % 1000000 = 0 | ||
if (n !== 0 && n % 1000000 === 0) return "many"; | ||
return "other"; | ||
if (n !== 0 && n % 1000000 === 0) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var f = +(s + ".").split(".")[1]; | ||
var v = (s + '.').split('.')[1].length; | ||
var f = +(s + '.').split('.')[1]; | ||
// v = 0 and i % 10 = 1 and i % 100 != 11 or f % 10 = 1 and f % 100 != 11 | ||
if (v === 0 && i % 10 === 1 && i % 100 !== 11 || f % 10 === 1 && f % 100 !== 11) return "one"; | ||
if (v === 0 && i % 10 === 1 && i % 100 !== 11 || f % 10 === 1 && f % 100 !== 11) return 'one'; | ||
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14 | ||
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14) || f % 10 >= 2 && f % 10 <= 4 && (f % 100 < 12 || f % 100 > 14)) return "few"; | ||
return "other"; | ||
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14) || f % 10 >= 2 && f % 10 <= 4 && (f % 100 < 12 || f % 100 > 14)) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
// i = 1 and v = 0 | ||
if (i === 1 && v === 0) return "one"; | ||
if (i === 1 && v === 0) return 'one'; | ||
// i = 2..4 and v = 0 | ||
if (i >= 2 && i <= 4 && v === 0) return "few"; | ||
if (i >= 2 && i <= 4 && v === 0) return 'few'; | ||
// v != 0 | ||
if (v !== 0) return "many"; | ||
return "other"; | ||
if (v !== 0) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 0 | ||
if (n === 0) return "zero"; | ||
if (n === 0) return 'zero'; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n = 2 | ||
if (n === 2) return "two"; | ||
if (n === 2) return 'two'; | ||
// n = 3 | ||
if (n === 3) return "few"; | ||
if (n === 3) return 'few'; | ||
// n = 6 | ||
if (n === 6) return "many"; | ||
return "other"; | ||
if (n === 6) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var t = +("" + s).replace(/^[^.]*.?|0+$/g, ""); | ||
var t = +('' + s).replace(/^[^.]*.?|0+$/g, ''); | ||
var n = +s; | ||
// n = 1 or t != 0 and i = 0,1 | ||
if (n === 1 || t !== 0 && (i === 0 || i === 1)) return "one"; | ||
return "other"; | ||
if (n === 1 || t !== 0 && (i === 0 || i === 1)) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var f = +(s + ".").split(".")[1]; | ||
var v = (s + '.').split('.')[1].length; | ||
var f = +(s + '.').split('.')[1]; | ||
// v = 0 and i % 100 = 1 or f % 100 = 1 | ||
if (v === 0 && i % 100 === 1 || f % 100 === 1) return "one"; | ||
if (v === 0 && i % 100 === 1 || f % 100 === 1) return 'one'; | ||
// v = 0 and i % 100 = 2 or f % 100 = 2 | ||
if (v === 0 && i % 100 === 2 || f % 100 === 2) return "two"; | ||
if (v === 0 && i % 100 === 2 || f % 100 === 2) return 'two'; | ||
// v = 0 and i % 100 = 3..4 or f % 100 = 3..4 | ||
if (v === 0 && (i % 100 >= 3 && i % 100 <= 4) || f % 100 >= 3 && f % 100 <= 4) return "few"; | ||
return "other"; | ||
if (v === 0 && (i % 100 >= 3 && i % 100 <= 4) || f % 100 >= 3 && f % 100 <= 4) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
// i = 0,1 | ||
if (i === 0 || i === 1) return "one"; | ||
return "other"; | ||
if (i === 0 || i === 1) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var f = +(s + ".").split(".")[1]; | ||
var v = (s + '.').split('.')[1].length; | ||
var f = +(s + '.').split('.')[1]; | ||
// v = 0 and i = 1,2,3 or v = 0 and i % 10 != 4,6,9 or v != 0 and f % 10 != 4,6,9 | ||
if (v === 0 && (i === 1 || i === 2 || i === 3) || v === 0 && (i % 10 !== 4 && i % 10 !== 6 && i % 10 !== 9) || v !== 0 && (f % 10 !== 4 && f % 10 !== 6 && f % 10 !== 9)) return "one"; | ||
return "other"; | ||
if (v === 0 && (i === 1 || i === 2 || i === 3) || v === 0 && (i % 10 !== 4 && i % 10 !== 6 && i % 10 !== 9) || v !== 0 && (f % 10 !== 4 && f % 10 !== 6 && f % 10 !== 9)) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n = 2 | ||
if (n === 2) return "two"; | ||
if (n === 2) return 'two'; | ||
// n = 3..6 | ||
if (n >= 3 && n <= 6) return "few"; | ||
if (n >= 3 && n <= 6) return 'few'; | ||
// n = 7..10 | ||
if (n >= 7 && n <= 10) return "many"; | ||
return "other"; | ||
if (n >= 7 && n <= 10) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1,11 | ||
if (n === 1 || n === 11) return "one"; | ||
if (n === 1 || n === 11) return 'one'; | ||
// n = 2,12 | ||
if (n === 2 || n === 12) return "two"; | ||
if (n === 2 || n === 12) return 'two'; | ||
// n = 3..10,13..19 | ||
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) return "few"; | ||
return "other"; | ||
if (n >= 3 && n <= 10 || n >= 13 && n <= 19) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
// v = 0 and i % 10 = 1 | ||
if (v === 0 && i % 10 === 1) return "one"; | ||
if (v === 0 && i % 10 === 1) return 'one'; | ||
// v = 0 and i % 10 = 2 | ||
if (v === 0 && i % 10 === 2) return "two"; | ||
if (v === 0 && i % 10 === 2) return 'two'; | ||
// v = 0 and i % 100 = 0,20,40,60,80 | ||
if (v === 0 && (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return "few"; | ||
if (v === 0 && (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return 'few'; | ||
// v != 0 | ||
if (v !== 0) return "many"; | ||
return "other"; | ||
if (v !== 0) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
var n = +s; | ||
// i = 1 and v = 0 | ||
if (i === 1 && v === 0) return "one"; | ||
if (i === 1 && v === 0) return 'one'; | ||
// i = 2 and v = 0 | ||
if (i === 2 && v === 0) return "two"; | ||
if (i === 2 && v === 0) return 'two'; | ||
// v = 0 and n != 0..10 and n % 10 = 0 | ||
if (v === 0 && (n < 0 || n > 10) && n % 10 === 0) return "many"; | ||
return "other"; | ||
if (v === 0 && (n < 0 || n > 10) && n % 10 === 0) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var t = +("" + s).replace(/^[^.]*.?|0+$/g, ""); | ||
var t = +('' + s).replace(/^[^.]*.?|0+$/g, ''); | ||
// t = 0 and i % 10 = 1 and i % 100 != 11 or t != 0 | ||
if (t === 0 && i % 10 === 1 && i % 100 !== 11 || t !== 0) return "one"; | ||
return "other"; | ||
if (t === 0 && i % 10 === 1 && i % 100 !== 11 || t !== 0) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n = 2 | ||
if (n === 2) return "two"; | ||
return "other"; | ||
if (n === 2) return 'two'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 0 | ||
if (n === 0) return "zero"; | ||
if (n === 0) return 'zero'; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
return "other"; | ||
if (n === 1) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
@@ -191,81 +191,81 @@ var i = Math.floor(Math.abs(+s)); | ||
// n = 0 | ||
if (n === 0) return "zero"; | ||
if (n === 0) return 'zero'; | ||
// i = 0,1 and n != 0 | ||
if ((i === 0 || i === 1) && n !== 0) return "one"; | ||
return "other"; | ||
if ((i === 0 || i === 1) && n !== 0) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var f = +(s + ".").split(".")[1]; | ||
var f = +(s + '.').split('.')[1]; | ||
var n = +s; | ||
// n % 10 = 1 and n % 100 != 11..19 | ||
if (n % 10 === 1 && (n % 100 < 11 || n % 100 > 19)) return "one"; | ||
if (n % 10 === 1 && (n % 100 < 11 || n % 100 > 19)) return 'one'; | ||
// n % 10 = 2..9 and n % 100 != 11..19 | ||
if (n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) return "few"; | ||
if (n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) return 'few'; | ||
// f != 0 | ||
if (f !== 0) return "many"; | ||
return "other"; | ||
if (f !== 0) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var v = (s + ".").split(".")[1].length; | ||
var f = +(s + ".").split(".")[1]; | ||
var v = (s + '.').split('.')[1].length; | ||
var f = +(s + '.').split('.')[1]; | ||
var n = +s; | ||
// n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19 | ||
if (n % 10 === 0 || n % 100 >= 11 && n % 100 <= 19 || v === 2 && (f % 100 >= 11 && f % 100 <= 19)) return "zero"; | ||
if (n % 10 === 0 || n % 100 >= 11 && n % 100 <= 19 || v === 2 && (f % 100 >= 11 && f % 100 <= 19)) return 'zero'; | ||
// n % 10 = 1 and n % 100 != 11 or v = 2 and f % 10 = 1 and f % 100 != 11 or v != 2 and f % 10 = 1 | ||
if (n % 10 === 1 && n % 100 !== 11 || v === 2 && f % 10 === 1 && f % 100 !== 11 || v !== 2 && f % 10 === 1) return "one"; | ||
return "other"; | ||
if (n % 10 === 1 && n % 100 !== 11 || v === 2 && f % 10 === 1 && f % 100 !== 11 || v !== 2 && f % 10 === 1) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var f = +(s + ".").split(".")[1]; | ||
var v = (s + '.').split('.')[1].length; | ||
var f = +(s + '.').split('.')[1]; | ||
// v = 0 and i % 10 = 1 or f % 10 = 1 | ||
if (v === 0 && i % 10 === 1 || f % 10 === 1) return "one"; | ||
return "other"; | ||
if (v === 0 && i % 10 === 1 || f % 10 === 1) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
var n = +s; | ||
// i = 1 and v = 0 | ||
if (i === 1 && v === 0) return "one"; | ||
if (i === 1 && v === 0) return 'one'; | ||
// v != 0 or n = 0 or n != 1 and n % 100 = 1..19 | ||
if (v !== 0 || n === 0 || n !== 1 && (n % 100 >= 1 && n % 100 <= 19)) return "few"; | ||
return "other"; | ||
if (v !== 0 || n === 0 || n !== 1 && (n % 100 >= 1 && n % 100 <= 19)) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n = 0 or n % 100 = 2..10 | ||
if (n === 0 || n % 100 >= 2 && n % 100 <= 10) return "few"; | ||
if (n === 0 || n % 100 >= 2 && n % 100 <= 10) return 'few'; | ||
// n % 100 = 11..19 | ||
if (n % 100 >= 11 && n % 100 <= 19) return "many"; | ||
return "other"; | ||
if (n % 100 >= 11 && n % 100 <= 19) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
// i = 1 and v = 0 | ||
if (i === 1 && v === 0) return "one"; | ||
if (i === 1 && v === 0) return 'one'; | ||
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14 | ||
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14)) return "few"; | ||
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14)) return 'few'; | ||
// v = 0 and i != 1 and i % 10 = 0..1 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 12..14 | ||
if (v === 0 && i !== 1 && (i % 10 >= 0 && i % 10 <= 1) || v === 0 && (i % 10 >= 5 && i % 10 <= 9) || v === 0 && (i % 100 >= 12 && i % 100 <= 14)) return "many"; | ||
return "other"; | ||
if (v === 0 && i !== 1 && (i % 10 >= 0 && i % 10 <= 1) || v === 0 && (i % 10 >= 5 && i % 10 <= 9) || v === 0 && (i % 100 >= 12 && i % 100 <= 14)) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 0..2 and n != 2 | ||
if (n >= 0 && n <= 2 && n !== 2) return "one"; | ||
return "other"; | ||
if (n >= 0 && n <= 2 && n !== 2) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
var n = +s; | ||
// n = 1 and v = 0 | ||
if (n === 1 && v === 0) return "one"; | ||
return "other"; | ||
if (n === 1 && v === 0) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
// v = 0 and i % 10 = 1 and i % 100 != 11 | ||
if (v === 0 && i % 10 === 1 && i % 100 !== 11) return "one"; | ||
if (v === 0 && i % 10 === 1 && i % 100 !== 11) return 'one'; | ||
// v = 0 and i % 10 = 2..4 and i % 100 != 12..14 | ||
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14)) return "few"; | ||
if (v === 0 && (i % 10 >= 2 && i % 10 <= 4) && (i % 100 < 12 || i % 100 > 14)) return 'few'; | ||
// v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14 | ||
if (v === 0 && i % 10 === 0 || v === 0 && (i % 10 >= 5 && i % 10 <= 9) || v === 0 && (i % 100 >= 11 && i % 100 <= 14)) return "many"; | ||
return "other"; | ||
if (v === 0 && i % 10 === 0 || v === 0 && (i % 10 >= 5 && i % 10 <= 9) || v === 0 && (i % 100 >= 11 && i % 100 <= 14)) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
@@ -275,152 +275,152 @@ var i = Math.floor(Math.abs(+s)); | ||
// i = 0 or n = 1 | ||
if (i === 0 || n === 1) return "one"; | ||
if (i === 0 || n === 1) return 'one'; | ||
// n = 2..10 | ||
if (n >= 2 && n <= 10) return "few"; | ||
return "other"; | ||
if (n >= 2 && n <= 10) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var f = +(s + ".").split(".")[1]; | ||
var f = +(s + '.').split('.')[1]; | ||
var n = +s; | ||
// n = 0,1 or i = 0 and f = 1 | ||
if (n === 0 || n === 1 || i === 0 && f === 1) return "one"; | ||
return "other"; | ||
if (n === 0 || n === 1 || i === 0 && f === 1) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
var v = (s + ".").split(".")[1].length; | ||
var v = (s + '.').split('.')[1].length; | ||
// v = 0 and i % 100 = 1 | ||
if (v === 0 && i % 100 === 1) return "one"; | ||
if (v === 0 && i % 100 === 1) return 'one'; | ||
// v = 0 and i % 100 = 2 | ||
if (v === 0 && i % 100 === 2) return "two"; | ||
if (v === 0 && i % 100 === 2) return 'two'; | ||
// v = 0 and i % 100 = 3..4 or v != 0 | ||
if (v === 0 && (i % 100 >= 3 && i % 100 <= 4) || v !== 0) return "few"; | ||
return "other"; | ||
if (v === 0 && (i % 100 >= 3 && i % 100 <= 4) || v !== 0) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 0..1 or n = 11..99 | ||
if (n >= 0 && n <= 1 || n >= 11 && n <= 99) return "one"; | ||
return "other"; | ||
if (n >= 0 && n <= 1 || n >= 11 && n <= 99) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1,5,7,8,9,10 | ||
if (n === 1 || n === 5 || n === 7 || n === 8 || n === 9 || n === 10) return "one"; | ||
if (n === 1 || n === 5 || n === 7 || n === 8 || n === 9 || n === 10) return 'one'; | ||
// n = 2,3 | ||
if (n === 2 || n === 3) return "two"; | ||
if (n === 2 || n === 3) return 'two'; | ||
// n = 4 | ||
if (n === 4) return "few"; | ||
if (n === 4) return 'few'; | ||
// n = 6 | ||
if (n === 6) return "many"; | ||
return "other"; | ||
if (n === 6) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
// i % 10 = 1,2,5,7,8 or i % 100 = 20,50,70,80 | ||
if (i % 10 === 1 || i % 10 === 2 || i % 10 === 5 || i % 10 === 7 || i % 10 === 8 || (i % 100 === 20 || i % 100 === 50 || i % 100 === 70 || i % 100 === 80)) return "one"; | ||
if (i % 10 === 1 || i % 10 === 2 || i % 10 === 5 || i % 10 === 7 || i % 10 === 8 || (i % 100 === 20 || i % 100 === 50 || i % 100 === 70 || i % 100 === 80)) return 'one'; | ||
// i % 10 = 3,4 or i % 1000 = 100,200,300,400,500,600,700,800,900 | ||
if (i % 10 === 3 || i % 10 === 4 || (i % 1000 === 100 || i % 1000 === 200 || i % 1000 === 300 || i % 1000 === 400 || i % 1000 === 500 || i % 1000 === 600 || i % 1000 === 700 || i % 1000 === 800 || i % 1000 === 900)) return "few"; | ||
if (i % 10 === 3 || i % 10 === 4 || (i % 1000 === 100 || i % 1000 === 200 || i % 1000 === 300 || i % 1000 === 400 || i % 1000 === 500 || i % 1000 === 600 || i % 1000 === 700 || i % 1000 === 800 || i % 1000 === 900)) return 'few'; | ||
// i = 0 or i % 10 = 6 or i % 100 = 40,60,90 | ||
if (i === 0 || i % 10 === 6 || (i % 100 === 40 || i % 100 === 60 || i % 100 === 90)) return "many"; | ||
return "other"; | ||
if (i === 0 || i % 10 === 6 || (i % 100 === 40 || i % 100 === 60 || i % 100 === 90)) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1,3 | ||
if (n === 1 || n === 3) return "one"; | ||
if (n === 1 || n === 3) return 'one'; | ||
// n = 2 | ||
if (n === 2) return "two"; | ||
if (n === 2) return 'two'; | ||
// n = 4 | ||
if (n === 4) return "few"; | ||
return "other"; | ||
if (n === 4) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 0,7,8,9 | ||
if (n === 0 || n === 7 || n === 8 || n === 9) return "zero"; | ||
if (n === 0 || n === 7 || n === 8 || n === 9) return 'zero'; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n = 2 | ||
if (n === 2) return "two"; | ||
if (n === 2) return 'two'; | ||
// n = 3,4 | ||
if (n === 3 || n === 4) return "few"; | ||
if (n === 3 || n === 4) return 'few'; | ||
// n = 5,6 | ||
if (n === 5 || n === 6) return "many"; | ||
return "other"; | ||
if (n === 5 || n === 6) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n % 10 = 1 and n % 100 != 11 | ||
if (n % 10 === 1 && n % 100 !== 11) return "one"; | ||
if (n % 10 === 1 && n % 100 !== 11) return 'one'; | ||
// n % 10 = 2 and n % 100 != 12 | ||
if (n % 10 === 2 && n % 100 !== 12) return "two"; | ||
if (n % 10 === 2 && n % 100 !== 12) return 'two'; | ||
// n % 10 = 3 and n % 100 != 13 | ||
if (n % 10 === 3 && n % 100 !== 13) return "few"; | ||
return "other"; | ||
if (n % 10 === 3 && n % 100 !== 13) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n = 2,3 | ||
if (n === 2 || n === 3) return "two"; | ||
if (n === 2 || n === 3) return 'two'; | ||
// n = 4 | ||
if (n === 4) return "few"; | ||
if (n === 4) return 'few'; | ||
// n = 6 | ||
if (n === 6) return "many"; | ||
return "other"; | ||
if (n === 6) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1,5 | ||
if (n === 1 || n === 5) return "one"; | ||
return "other"; | ||
if (n === 1 || n === 5) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 11,8,80,800 | ||
if (n === 11 || n === 8 || n === 80 || n === 800) return "many"; | ||
return "other"; | ||
if (n === 11 || n === 8 || n === 80 || n === 800) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
// i = 1 | ||
if (i === 1) return "one"; | ||
if (i === 1) return 'one'; | ||
// i = 0 or i % 100 = 2..20,40,60,80 | ||
if (i === 0 || (i % 100 >= 2 && i % 100 <= 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return "many"; | ||
return "other"; | ||
if (i === 0 || (i % 100 >= 2 && i % 100 <= 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n % 10 = 6 or n % 10 = 9 or n % 10 = 0 and n != 0 | ||
if (n % 10 === 6 || n % 10 === 9 || n % 10 === 0 && n !== 0) return "many"; | ||
return "other"; | ||
if (n % 10 === 6 || n % 10 === 9 || n % 10 === 0 && n !== 0) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var i = Math.floor(Math.abs(+s)); | ||
// i % 10 = 1 and i % 100 != 11 | ||
if (i % 10 === 1 && i % 100 !== 11) return "one"; | ||
if (i % 10 === 1 && i % 100 !== 11) return 'one'; | ||
// i % 10 = 2 and i % 100 != 12 | ||
if (i % 10 === 2 && i % 100 !== 12) return "two"; | ||
if (i % 10 === 2 && i % 100 !== 12) return 'two'; | ||
// i % 10 = 7,8 and i % 100 != 17,18 | ||
if ((i % 10 === 7 || i % 10 === 8) && (i % 100 !== 17 && i % 100 !== 18)) return "many"; | ||
return "other"; | ||
if ((i % 10 === 7 || i % 10 === 8) && (i % 100 !== 17 && i % 100 !== 18)) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n = 2,3 | ||
if (n === 2 || n === 3) return "two"; | ||
if (n === 2 || n === 3) return 'two'; | ||
// n = 4 | ||
if (n === 4) return "few"; | ||
return "other"; | ||
if (n === 4) return 'few'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1..4 | ||
if (n >= 1 && n <= 4) return "one"; | ||
return "other"; | ||
if (n >= 1 && n <= 4) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n = 1 | ||
if (n === 1) return "one"; | ||
if (n === 1) return 'one'; | ||
// n % 10 = 4 and n % 100 != 14 | ||
if (n % 10 === 4 && n % 100 !== 14) return "many"; | ||
return "other"; | ||
if (n % 10 === 4 && n % 100 !== 14) return 'many'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n % 10 = 1,2 and n % 100 != 11,12 | ||
if ((n % 10 === 1 || n % 10 === 2) && (n % 100 !== 11 && n % 100 !== 12)) return "one"; | ||
return "other"; | ||
if ((n % 10 === 1 || n % 10 === 2) && (n % 100 !== 11 && n % 100 !== 12)) return 'one'; | ||
return 'other'; | ||
}, function (s) { | ||
var n = +s; | ||
// n % 10 = 3 and n % 100 != 13 | ||
if (n % 10 === 3 && n % 100 !== 13) return "few"; | ||
return "other"; | ||
if (n % 10 === 3 && n % 100 !== 13) return 'few'; | ||
return 'other'; | ||
}]; | ||
@@ -493,3 +493,3 @@ | ||
ii: { plural: p[6] }, | ||
"in": { plural: p[6], ordinal: p[6] }, | ||
'in': { plural: p[6], ordinal: p[6] }, | ||
is: { plural: p[19], ordinal: p[6] }, | ||
@@ -566,3 +566,3 @@ it: { plural: p[4], ordinal: p[43] }, | ||
pt: { plural: p[29], ordinal: p[6] }, | ||
"pt-PT": { plural: p[30] }, | ||
'pt-PT': { plural: p[30] }, | ||
rm: { plural: p[0] }, | ||
@@ -569,0 +569,0 @@ ro: { plural: p[26], ordinal: p[0] }, |
// "lookup" algorithm http://tools.ietf.org/html/rfc4647#section-3.4 | ||
"use strict"; | ||
'use strict'; | ||
module.exports = lookupClosestLocale; | ||
exports.__esModule = true; | ||
exports['default'] = lookupClosestLocale; | ||
@@ -9,6 +10,6 @@ function lookupClosestLocale(locale, available) { | ||
for (var l = 0, ll = locales.length; l < ll; ++l) { | ||
var current = locales[l].split("-"); | ||
var current = locales[l].split('-'); | ||
while (current.length) { | ||
if (current.join("-") in available) { | ||
return current.join("-"); | ||
if (current.join('-') in available) { | ||
return current.join('-'); | ||
} | ||
@@ -18,3 +19,5 @@ current.pop(); | ||
} | ||
return "en"; | ||
} | ||
return 'en'; | ||
} | ||
module.exports = exports['default']; |
@@ -1,9 +0,1 @@ | ||
"use strict"; | ||
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; }; | ||
/** | ||
* Intl.MessageFormat class | ||
**/ | ||
module.exports = MessageFormat; | ||
/*! | ||
@@ -15,10 +7,29 @@ * Intl.MessageFormat polyfill | ||
var Parser = _interopRequire(require("./parser")); | ||
'use strict'; | ||
var Interpreter = _interopRequire(require("./interpreter")); | ||
exports.__esModule = true; | ||
exports['default'] = MessageFormat; | ||
var lookupClosestLocale = _interopRequire(require("./lookup-closest-locale")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
var data = _interopRequire(require("./data")); | ||
var _parser = require('./parser'); | ||
var _parser2 = _interopRequireDefault(_parser); | ||
var _interpreter = require('./interpreter'); | ||
var _interpreter2 = _interopRequireDefault(_interpreter); | ||
var _lookupClosestLocale = require('./lookup-closest-locale'); | ||
var _lookupClosestLocale2 = _interopRequireDefault(_lookupClosestLocale); | ||
var _data = require('./data'); | ||
var _data2 = _interopRequireDefault(_data); | ||
/** | ||
* Intl.MessageFormat class | ||
**/ | ||
function MessageFormat(pattern, locale) { | ||
@@ -28,15 +39,15 @@ var options = arguments[2] === undefined ? {} : arguments[2]; | ||
// don't use class so it can be called without new | ||
if (typeof this !== "object" || !(this instanceof MessageFormat)) { | ||
if (typeof this !== 'object' || !(this instanceof MessageFormat)) { | ||
return new MessageFormat(pattern, locale, options); | ||
} | ||
if (typeof pattern !== "string") { | ||
throw new TypeError("message pattern must be a string"); | ||
if (typeof pattern !== 'string') { | ||
throw new TypeError('message pattern must be a string'); | ||
} | ||
var closest = lookupClosestLocale(locale, MessageFormat.data.locales); | ||
var closest = _lookupClosestLocale2['default'](locale, MessageFormat.data.locales); | ||
var data = MessageFormat.data.locales[closest]; | ||
var enableCache = "cache" in options ? options.cache : true; | ||
var enableCache = 'cache' in options ? options.cache : true; | ||
var cache = MessageFormat.data.formats.cache; | ||
var key = closest + ":message:" + pattern; | ||
var key = closest + ':message:' + pattern; | ||
var formats = MessageFormat.data.formats; | ||
@@ -48,3 +59,3 @@ var format = undefined; | ||
} else { | ||
format = Interpreter.interpret(Parser.parse(pattern, { | ||
format = _interpreter2['default'].interpret(_parser2['default'].parse(pattern, { | ||
escape: options.escape | ||
@@ -90,4 +101,5 @@ }), { | ||
data: { | ||
value: data | ||
value: _data2['default'] | ||
} | ||
}); | ||
}); | ||
module.exports = exports['default']; |
@@ -1,7 +0,1 @@ | ||
"use strict"; | ||
var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; | ||
/** | ||
@@ -24,3 +18,10 @@ * Parser | ||
**/ | ||
'use strict'; | ||
exports.__esModule = true; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var Parser = (function () { | ||
@@ -34,3 +35,3 @@ function Parser() { | ||
this.escape = escape || "'"; | ||
this.escape = escape || '\''; | ||
this.pattern = null; | ||
@@ -43,11 +44,11 @@ this.index = 0; | ||
this.index = 0; | ||
return this.parseMessage("message"); | ||
return this.parseMessage('message'); | ||
}; | ||
Parser.prototype.isDigit = function isDigit(char) { | ||
return char === "0" || char === "1" || char === "2" || char === "3" || char === "4" || char === "5" || char === "6" || char === "7" || char === "8" || char === "9"; | ||
return char === '0' || char === '1' || char === '2' || char === '3' || char === '4' || char === '5' || char === '6' || char === '7' || char === '8' || char === '9'; | ||
}; | ||
Parser.prototype.isWhitespace = function isWhitespace(char) { | ||
return char === " " || char === "\t" || char === "\n" || char === "\r" || char === "\f" || char === "\u000b" || char === " " || char === "\u2028" || char === "\u2029"; | ||
return char === ' ' || char === '\t' || char === '\n' || char === '\r' || char === '\f' || char === '\u000b' || char === ' ' || char === '\u2028' || char === '\u2029'; | ||
}; | ||
@@ -66,14 +67,14 @@ | ||
var length = pattern.length; | ||
var isHashSpecial = parentType === "plural" || parentType === "selectordinal"; | ||
var isArgStyle = parentType === "style"; | ||
var isHashSpecial = parentType === 'plural' || parentType === 'selectordinal'; | ||
var isArgStyle = parentType === 'style'; | ||
var escape = this.escape; | ||
var text = ""; | ||
var text = ''; | ||
var char = undefined; | ||
while (this.index < length) { | ||
char = pattern.charAt(this.index); | ||
if (char === "{" || char === "}" || isHashSpecial && char === "#" || isArgStyle && this.isWhitespace(char)) { | ||
if (char === '{' || char === '}' || isHashSpecial && char === '#' || isArgStyle && this.isWhitespace(char)) { | ||
break; | ||
} else if (escape === "'" && char === "'") { | ||
} else if (escape === '\'' && char === '\'') { | ||
char = pattern.charAt(++this.index); | ||
if (char === "'") { | ||
if (char === '\'') { | ||
// double is always 1 ' | ||
@@ -84,11 +85,11 @@ text += char; | ||
// only when necessary | ||
char === "{" || char === "}" || isHashSpecial && char === "#" || isArgStyle && this.isWhitespace(char)) { | ||
char === '{' || char === '}' || isHashSpecial && char === '#' || isArgStyle && this.isWhitespace(char)) { | ||
text += char; | ||
while (++this.index < length) { | ||
char = pattern.charAt(this.index); | ||
if (pattern.slice(this.index, this.index + 2) === "''") { | ||
if (pattern.slice(this.index, this.index + 2) === '\'\'') { | ||
// double is always 1 ' | ||
text += char; | ||
++this.index; | ||
} else if (char === "'") { | ||
} else if (char === '\'') { | ||
// end of quoted | ||
@@ -103,3 +104,3 @@ ++this.index; | ||
// lone ' is just a ' | ||
text += "'" | ||
text += '\'' | ||
// already incremented | ||
@@ -123,5 +124,5 @@ ; | ||
var pattern = this.pattern; | ||
if (pattern.charAt(this.index) === "#") { | ||
if (pattern.charAt(this.index) === '#') { | ||
++this.index; // move passed # | ||
return ["#"]; | ||
return ['#']; | ||
} | ||
@@ -132,3 +133,3 @@ | ||
var char = pattern.charAt(this.index); | ||
if (char === "}") { | ||
if (char === '}') { | ||
// end argument | ||
@@ -138,4 +139,4 @@ ++this.index; // move passed } | ||
} | ||
if (char !== ",") { | ||
this.throwExpected(","); | ||
if (char !== ',') { | ||
this.throwExpected(','); | ||
} | ||
@@ -146,6 +147,6 @@ ++this.index; // move passed , | ||
char = pattern.charAt(this.index); | ||
if (char === "}") { | ||
if (char === '}') { | ||
// end argument | ||
if (type === "plural" || type === "selectordinal" || type === "select") { | ||
this.throwExpected(type + " message options"); | ||
if (type === 'plural' || type === 'selectordinal' || type === 'select') { | ||
this.throwExpected(type + ' message options'); | ||
} | ||
@@ -155,4 +156,4 @@ ++this.index; // move passed } | ||
} | ||
if (char !== ",") { | ||
this.throwExpected(","); | ||
if (char !== ',') { | ||
this.throwExpected(','); | ||
} | ||
@@ -163,6 +164,6 @@ ++this.index; // move passed , | ||
var offset = undefined; | ||
if (type === "plural" || type === "selectordinal") { | ||
if (type === 'plural' || type === 'selectordinal') { | ||
offset = this.parsePluralOffset(); | ||
format = this.parseSubMessages(type); | ||
} else if (type === "select") { | ||
} else if (type === 'select') { | ||
format = this.parseSubMessages(type); | ||
@@ -173,9 +174,9 @@ } else { | ||
char = pattern.charAt(this.index); | ||
if (char !== "}") { | ||
if (char !== '}') { | ||
// not ended argument | ||
this.throwExpected("}"); | ||
this.throwExpected('}'); | ||
} | ||
++this.index; // move passed | ||
return type === "plural" || type === "selectordinal" ? [id, type, offset, format] : [id, type, format]; | ||
return type === 'plural' || type === 'selectordinal' ? [id, type, offset, format] : [id, type, format]; | ||
}; | ||
@@ -187,9 +188,9 @@ | ||
var length = pattern.length; | ||
var id = ""; | ||
var id = ''; | ||
while (this.index < length) { | ||
var char = pattern.charAt(this.index); | ||
if (char === "{" || char === "#") { | ||
this.throwExpected("argument id"); | ||
if (char === '{' || char === '#') { | ||
this.throwExpected('argument id'); | ||
} | ||
if (char === "}" || char === "," || this.isWhitespace(char)) { | ||
if (char === '}' || char === ',' || this.isWhitespace(char)) { | ||
break; | ||
@@ -201,3 +202,3 @@ } | ||
if (!id) { | ||
this.throwExpected("argument id"); | ||
this.throwExpected('argument id'); | ||
} | ||
@@ -212,3 +213,3 @@ this.skipWhitespace(); | ||
var argType = undefined; | ||
var types = ["number", "date", "time", "ordinal", "duration", "spellout", "plural", "selectordinal", "select"]; | ||
var types = ['number', 'date', 'time', 'ordinal', 'duration', 'spellout', 'plural', 'selectordinal', 'select']; | ||
for (var t = 0, tt = types.length; t < tt; ++t) { | ||
@@ -223,3 +224,3 @@ var type = types[t]; | ||
if (!argType) { | ||
this.throwExpected(types.join(", ")); | ||
this.throwExpected(types.join(', ')); | ||
} | ||
@@ -232,5 +233,5 @@ this.skipWhitespace(); | ||
this.skipWhitespace(); | ||
var style = this.parseText("style"); | ||
var style = this.parseText('style'); | ||
if (!style) { | ||
this.throwExpected("argument style name"); | ||
this.throwExpected('argument style name'); | ||
} | ||
@@ -246,3 +247,3 @@ this.skipWhitespace(); | ||
var length = pattern.length; | ||
if (pattern.slice(this.index, this.index + 7) === "offset:") { | ||
if (pattern.slice(this.index, this.index + 7) === 'offset:') { | ||
this.index += 7; // move passed offset: | ||
@@ -255,3 +256,3 @@ this.skipWhitespace(); | ||
if (start === this.index) { | ||
this.throwExpected("offset number"); | ||
this.throwExpected('offset number'); | ||
} | ||
@@ -270,3 +271,3 @@ offset = +pattern.slice(start, this.index); | ||
var hasSubs = false; | ||
while (this.index < length && pattern.charAt(this.index) !== "}") { | ||
while (this.index < length && pattern.charAt(this.index) !== '}') { | ||
var selector = this.parseSelector(); | ||
@@ -279,7 +280,7 @@ this.skipWhitespace(); | ||
if (!hasSubs) { | ||
this.throwExpected(parentType + " message options"); | ||
this.throwExpected(parentType + ' message options'); | ||
} | ||
if (!("other" in options)) { | ||
if (!('other' in options)) { | ||
// does not have an other selector | ||
this.throwExpected(null, null, "\"other\" option must be specified in " + parentType); | ||
this.throwExpected(null, null, '"other" option must be specified in ' + parentType); | ||
} | ||
@@ -292,9 +293,9 @@ return options; | ||
var length = pattern.length; | ||
var selector = ""; | ||
var selector = ''; | ||
while (this.index < length) { | ||
var char = pattern.charAt(this.index); | ||
if (char === "}" || char === ",") { | ||
this.throwExpected("{"); | ||
if (char === '}' || char === ',') { | ||
this.throwExpected('{'); | ||
} | ||
if (char === "{" || this.isWhitespace(char)) { | ||
if (char === '{' || this.isWhitespace(char)) { | ||
break; | ||
@@ -306,3 +307,3 @@ } | ||
if (!selector) { | ||
this.throwExpected("selector"); | ||
this.throwExpected('selector'); | ||
} | ||
@@ -315,4 +316,4 @@ this.skipWhitespace(); | ||
var char = this.pattern.charAt(this.index); | ||
if (char !== "{") { | ||
this.throwExpected("{"); | ||
if (char !== '{') { | ||
this.throwExpected('{'); | ||
} | ||
@@ -322,4 +323,4 @@ ++this.index; // move passed { | ||
char = this.pattern.charAt(this.index); | ||
if (char !== "}") { | ||
this.throwExpected("}"); | ||
if (char !== '}') { | ||
this.throwExpected('}'); | ||
} | ||
@@ -339,4 +340,4 @@ ++this.index; // move passed } | ||
while (this.index < length) { | ||
if (pattern.charAt(this.index) === "}") { | ||
if (parentType === "message") { | ||
if (pattern.charAt(this.index) === '}') { | ||
if (parentType === 'message') { | ||
this.throwExpected(); | ||
@@ -361,3 +362,3 @@ } | ||
if (!found) { | ||
found = this.pattern.charAt(this.index) || "end of input"; | ||
found = this.pattern.charAt(this.index) || 'end of input'; | ||
} | ||
@@ -367,3 +368,3 @@ if (!message) { | ||
} | ||
message += " in " + pattern.replace(/\r?\n/g, "\n"); | ||
message += ' in ' + pattern.replace(/\r?\n/g, '\n'); | ||
@@ -375,5 +376,5 @@ throw new SyntaxError(message, expected, found, offset, line, column); | ||
if (!expected) { | ||
return "Unexpected " + found + " found"; | ||
return 'Unexpected ' + found + ' found'; | ||
} | ||
return "Expected " + expected + " but " + found + " found"; | ||
return 'Expected ' + expected + ' but ' + found + ' found'; | ||
}; | ||
@@ -388,3 +389,3 @@ | ||
module.exports = Parser; | ||
exports['default'] = Parser; | ||
@@ -400,3 +401,4 @@ /** | ||
this.name = "SyntaxError"; | ||
_Error.call(this, message); | ||
this.name = 'SyntaxError'; | ||
this.message = message; | ||
@@ -415,2 +417,3 @@ this.expected = expected; | ||
Parser.SyntaxError = SyntaxError; | ||
Parser.SyntaxError = SyntaxError; | ||
module.exports = exports['default']; |
@@ -1,5 +0,1 @@ | ||
"use strict"; | ||
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; | ||
/** | ||
@@ -22,3 +18,8 @@ * Printer | ||
**/ | ||
'use strict'; | ||
exports.__esModule = true; | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var Printer = (function () { | ||
@@ -38,12 +39,12 @@ function Printer() { | ||
return _this.printElement(element, parent); | ||
}).join(""); | ||
}).join(''); | ||
}; | ||
Printer.prototype.printElement = function printElement(element, parent) { | ||
if (typeof element === "string") { | ||
if (typeof element === 'string') { | ||
return this.printString(element, parent); | ||
} | ||
if (element[0] === "#") { | ||
return "#"; | ||
if (element[0] === '#') { | ||
return '#'; | ||
} | ||
@@ -53,6 +54,6 @@ | ||
switch (type) { | ||
case "plural": | ||
case "selectordinal": | ||
case 'plural': | ||
case 'selectordinal': | ||
return this.printPlural(element); | ||
case "select": | ||
case 'select': | ||
return this.printSelect(element); | ||
@@ -65,5 +66,5 @@ default: | ||
Printer.prototype.printString = function printString(element, parent) { | ||
var special = parent === "plural" ? /[{}#]+/g : /[{}]+/g; | ||
return element.replace(/'/g, "''") // double apostrophe | ||
.replace(special, "'$&'") // escape syntax | ||
var special = parent === 'plural' ? /[{}#]+/g : /[{}]+/g; | ||
return element.replace(/'/g, '\'\'') // double apostrophe | ||
.replace(special, '\'$&\'') // escape syntax | ||
; | ||
@@ -76,3 +77,3 @@ }; | ||
var style = element[2]; | ||
return "{ " + key + (type ? ", " + type : "") + (style ? ", " + this.printString(style) : "") + " }"; | ||
return '{ ' + key + (type ? ', ' + type : '') + (style ? ', ' + this.printString(style) : '') + ' }'; | ||
}; | ||
@@ -85,3 +86,3 @@ | ||
var options = element[3]; | ||
return "{ " + key + ", " + type + "," + (offset ? " offset:" + offset : "") + this.printOptions(options, "plural") + "\n}"; | ||
return '{ ' + key + ', ' + type + ',' + (offset ? ' offset:' + offset : '') + this.printOptions(options, 'plural') + '\n}'; | ||
}; | ||
@@ -93,7 +94,7 @@ | ||
var options = element[2]; | ||
return "{ " + key + ", " + type + "," + this.printOptions(options, "select") + "\n}"; | ||
return '{ ' + key + ', ' + type + ',' + this.printOptions(options, 'select') + '\n}'; | ||
}; | ||
Printer.prototype.printOptions = function printOptions(options, parent) { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -105,10 +106,10 @@ var keys = Object.keys(options); | ||
return keys.map(function (key) { | ||
return "\n " + _this.leftSpacePad(key, padLength) + " {" + _this.printMessage(options[key], parent) + "}"; | ||
}).join(""); | ||
return '\n ' + _this2.leftSpacePad(key, padLength) + ' {' + _this2.printMessage(options[key], parent) + '}'; | ||
}).join(''); | ||
}; | ||
Printer.prototype.leftSpacePad = function leftSpacePad(string, count) { | ||
var padding = ""; | ||
var padding = ''; | ||
for (var i = string.length; i < count; ++i) { | ||
padding += " "; | ||
padding += ' '; | ||
} | ||
@@ -125,2 +126,3 @@ return padding + string; | ||
module.exports = Printer; | ||
exports['default'] = Printer; | ||
module.exports = exports['default']; |
{ | ||
"name": "message-format", | ||
"version": "1.2.0", | ||
"description": "Intl.MessageFormat polyfill supporting ICU message format", | ||
"version": "1.2.1", | ||
"description": "Intl.MessageFormat prollyfill supporting ICU message format", | ||
"keywords": [ | ||
@@ -22,25 +22,25 @@ "i18n", | ||
"devDependencies": { | ||
"babel": "4.7.16", | ||
"babel-core": "4.7.16", | ||
"babel-loader": "4.2.0", | ||
"benchmark": "1.0.0", | ||
"chai": "2.1.2", | ||
"cldr-core": "27.0.0", | ||
"intl": "0.1.4", | ||
"intl-messageformat": "1.1.0", | ||
"istanbul": "0.3.10", | ||
"karma": "0.12.31", | ||
"karma-chai": "0.1.0", | ||
"karma-chrome-launcher": "0.1.7", | ||
"karma-cli": "0.0.4", | ||
"karma-coverage": "0.2.7", | ||
"babel": "^5.6.14", | ||
"babel-core": "^5.6.15", | ||
"babel-loader": "^5.3.1", | ||
"benchmark": "^1.0.0", | ||
"chai": "^3.0.0", | ||
"cldr-core": "^27.0.0", | ||
"intl": "^0.1.4", | ||
"intl-messageformat": "^1.1.0", | ||
"istanbul": "^0.3.17", | ||
"karma": "^0.12.37", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^0.2.0", | ||
"karma-cli": "^0.1.0", | ||
"karma-coverage": "^0.4.2", | ||
"karma-firefox-launcher": "^0.1.4", | ||
"karma-mocha": "0.1.10", | ||
"karma-phantomjs-launcher": "0.1.4", | ||
"karma-safari-launcher": "0.1.1", | ||
"karma-sourcemap-loader": "0.3.4", | ||
"karma-webpack": "1.5.0", | ||
"mocha": "2.2.1", | ||
"standard": "^3.2.1", | ||
"webpack": "1.7.3" | ||
"karma-mocha": "^0.2.0", | ||
"karma-phantomjs-launcher": "^0.2.0", | ||
"karma-safari-launcher": "^0.1.1", | ||
"karma-sourcemap-loader": "^0.3.5", | ||
"karma-webpack": "^1.5.1", | ||
"mocha": "^2.2.5", | ||
"standard": "^4.5.2", | ||
"webpack": "^1.10.1" | ||
}, | ||
@@ -63,3 +63,3 @@ "scripts": { | ||
"type": "git", | ||
"url": "http://github.com/thetalecrafter/message-format.git" | ||
"url": "http://github.com/format-message/message-format.git" | ||
}, | ||
@@ -72,5 +72,5 @@ "author": { | ||
"bugs": { | ||
"url": "https://github.com/thetalecrafter/message-format/issues" | ||
"url": "https://github.com/format-message/message-format/issues" | ||
}, | ||
"homepage": "https://github.com/thetalecrafter/message-format" | ||
"homepage": "https://github.com/format-message/message-format" | ||
} |
# message-format | ||
> Intl.MessageFormat polyfill supporting ICU message format | ||
> Intl.MessageFormat prollyfill supporting ICU message format | ||
@@ -46,3 +46,3 @@ [![npm Version][npm-image]][npm] | ||
at this point, this library represents only one possible way the standard api | ||
could eventually work. | ||
could eventually work, hence "prollyfill". | ||
@@ -238,9 +238,9 @@ ### Loading locale data | ||
[npm-image]: https://img.shields.io/npm/v/message-format.svg | ||
[deps]: https://david-dm.org/thetalecrafter/message-format | ||
[deps-image]: https://img.shields.io/david/thetalecrafter/message-format.svg | ||
[build]: https://travis-ci.org/thetalecrafter/message-format | ||
[build-image]: https://img.shields.io/travis/thetalecrafter/message-format.svg | ||
[deps]: https://david-dm.org/format-message/message-format | ||
[deps-image]: https://img.shields.io/david/format-message/message-format.svg | ||
[build]: https://travis-ci.org/format-message/message-format | ||
[build-image]: https://img.shields.io/travis/format-message/message-format.svg | ||
[style]: https://github.com/feross/standard | ||
[style-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg | ||
[format-message]: https://github.com/thetalecrafter/format-message | ||
[format-message]: https://github.com/format-message/format-message | ||
[icu-message]: http://userguide.icu-project.org/formatparse/messages | ||
@@ -252,2 +252,2 @@ [icu-cpp]: http://icu-project.org/apiref/icu4c/classicu_1_1MessageFormat.html | ||
[intl]: https://github.com/andyearnshaw/Intl.js | ||
[LICENSE]: https://github.com/thetalecrafter/message-format/blob/master/LICENSE-MIT | ||
[LICENSE]: https://github.com/format-message/message-format/blob/master/LICENSE-MIT |
Sorry, the diff of this file is not supported yet
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
212558
1517