-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreadint.min.js
24 lines (24 loc) · 4.72 KB
/
readint.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
!function(){function e(n,i,t){var r,l,s=e.resolve(n)
if(null==s)throw t=t||n,i=i||"root",r=Error('Failed to require "'+t+'" from "'+i+'"'),r.path=t,r.parent=i,r.require=!0,r
return l=e.modules[s],l.exports||(l.exports={},l.client=l.component=!0,l.call(this,l.exports,e.relative(s),l)),l.exports}e.modules={},e.aliases={},e.resolve=function(n){var i,t
for("/"===n.charAt(0)&&(n=n.slice(1)),i=[n,n+".js",n+".json",n+"/index.js",n+"/index.json"],t=0;t<i.length;t++){if(n=i[t],e.modules.hasOwnProperty(n))return n
if(e.aliases.hasOwnProperty(n))return e.aliases[n]}},e.normalize=function(e,n){var i,t=[]
if("."!=n.charAt(0))return n
for(e=e.split("/"),n=n.split("/"),i=0;i<n.length;++i)".."==n[i]?e.pop():"."!=n[i]&&""!=n[i]&&t.push(n[i])
return e.concat(t).join("/")},e.register=function(n,i){e.modules[n]=i},e.alias=function(n,i){if(!e.modules.hasOwnProperty(n))throw Error('Failed to alias "'+n+'", it does not exist')
e.aliases[i]=n},e.relative=function(n){function i(e,n){for(var i=e.length;i--;)if(e[i]===n)return i
return-1}function t(i){var r=t.resolve(i)
return e(r,n,i)}var r=e.normalize(n,"..")
return t.resolve=function(t){var l,s,o=t.charAt(0)
return"/"==o?t.slice(1):"."==o?e.normalize(r,t):(l=n.split("/"),s=i(l,"deps")+1,s||(s=0),t=l.slice(0,s+1).join("/")+"/deps/"+t)},t.exists=function(n){return e.modules.hasOwnProperty(t.resolve(n))},t},e.register("readint/bin/readint.js",function(e,n,i){i.exports=n("../lib/readint.js")}),e.register("readint/lib/readint.js",function(e,n,i){function t(e,i){return isNaN(global=parseInt(e))?(void 0===i&&(i="en"),i=n("../locales/"+i),(tokens=l(e,i)).length>0?r(tokens,i):-1):global}function r(e,n){var i,t,l,s,o
if(1===e.length)return e[0].value
if(0===e.length)return-1
for(l=-1,s=-1,o=0;o<e.length;++o)e[o].level>s&&(s=e[o].level,l=o)
return i=r(e.slice(0,l),n),-1===(t=r(e.slice(l+1),n))&&(t=0),-1!==n.LTRlevels.indexOf(s)?(-1===i?0:i)+e[l].value+t:(-1===i?1:i)*e[l].value+t}function l(e,n){var i,t,r,l,o=[]
for(i=0,t=e.toLowerCase().split(n.split),r=s(n.values);void 0!==t[i];++i)if(0!==t[i].length){for(l=0;l<n.replace.length;++l)t[i]=t[i].replace(n.replace[l][0],n.replace[l][1])
for(l=0;;++l){if(l>=r.length){t.splice(i--,1)
break}if(t[i]===r[l].string){o.push(r[l])
break}}}else t.splice(i--,1)
return o}function s(e){var n,i,t=[]
for(n=0;n<e.length;++n)for(i in e[n])t.push({string:i,value:e[n][i],level:n})
return t}i.exports=t}),e.register("readint/locales/en.js",function(e,n,i){i.exports={split:/\s|\sand|(?=teen)/,replace:[[/ies?$/g,"y"],[/s$/g,""]],LTRlevels:[1],values:[{zero:0,one:1,two:2,three:3,thir:3,four:4,five:5,fif:5,six:6,seven:7,eight:8,eigh:8,nine:9,eleven:11,twelve:12},{ten:10,teen:10,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90},{hundred:100},{thousand:1e3},{million:1e6},{billion:1e9},{trillion:1e12}]}}),e.register("readint/locales/es.js",function(e,n,i){i.exports={split:/[y ]*(?=[^y ]*)(?:(.ientos|veinti|dieci|y| ))(?=[^y ]*)[y ]*/,replace:[[/[y ]/g,""],[/á/g,"a"],[/é/g,"e"],[/ú/g,"u"],[/ó/g,"o"],[/ñ/g,"n"],[/í/g,"i"],[/quinien/g,"quincien"],[/millones?/g,"millon"],[/(un|[cn]ien)t?[oa]s?/g,"$1"]],LTRlevels:[],values:[{cero:0,un:1,dos:2,tres:3,cuatro:4,cinco:5,qui:5,seis:6,siete:7,sete:7,ocho:8,nueve:9,nove:9,once:11,doze:12,trece:13,catorce:14,quince:15},{diez:10,dieci:10,veinte:20,veinti:20,treinta:30,cuarenta:40,cincuenta:50,sesenta:60,setenta:70,ochenta:80,noventa:90},{cien:100,nien:100},{mil:1e3},{millon:1e6,millone:1e6},{billon:1e9,billone:1e9},{trillon:1e12,trillone:1e12}]}}),e.register("readint/locales/fr.js",function(e,n,i){i.exports={split:/et|\s|-/,replace:[[/s$/g,""],[/[àâ]/g,"a"],[/[êéèë]/g,"e"],[/[ùûûü]/g,"u"],[/ô/g,"o"],[/ç/g,"c"],[/[îï]/g,"i"]],LTRlevels:[],values:[{zero:0,un:1,deux:2,troi:3,quatre:4,cinq:5,six:6,sept:7,huit:8,neuf:9,onze:11,douze:12,treize:13,quatorze:14,quinze:15,seize:16},{dix:10,vingt:20,trente:30,quarante:40,cinquante:50,soixante:60,"soixante-dix":70,septante:70,"quatre-vingt":80,octante:80,"quatre-vingt-dix":90,nonante:90},{cent:100},{mille:1e3},{million:1e6},{milliard:1e9},{billion:1e12}]}}),e.register("readint/locales/de.js",function(e,n,i){i.exports={split:/-|(zehn|hundert|tausend|millione?n?|milliarde?n?|billione?n?|und(?!ert))/,replace:[[/\s/g,""],[/ä/g,"a"],[/ö/g,"o"],[/ü/g,"ue"],[/ß/g,"ss"],[/[es][ns]?(\s|$)/g,""]],LTRlevels:[1],values:[{"null":0,ein:1,zwei:2,drei:3,vier:4,fuenf:5,sech:6,sieb:7,acht:8,neun:9,elf:11,zwoelf:12},{zehn:10,zwanzig:20,dreissig:30,vierzig:40,fuenfzig:50,sechzig:60,siebzig:70,achtzig:80,neunzig:90},{hundert:100},{tausend:1e3},{million:1e6},{milliard:1e9},{billion:1e12}]}}),e.alias("readint/bin/readint.js","readint/index.js"),"object"==typeof exports?module.exports=e("readint"):"function"==typeof define&&define.amd?define(function(){return e("readint")}):this.readint=e("readint")}()