EVOLUTION-NINJA
Edit File: EAN_UPC.min.js
function EAN(n){this.EANnumber=n+"",this.valid=function(){return a(this.EANnumber)},this.encoded=function(){return a(this.EANnumber)?(n=this.EANnumber,L="",t=n[0],r=n.substr(1,7),s=n.substr(7,6),L+=e,L+=o(r,G[t]),L+=u,L+=o(s,"RRRRRR"),L+=i):"";var n,L,t,r,s};var L={0:"0001101",1:"0011001",2:"0010011",3:"0111101",4:"0100011",5:"0110001",6:"0101111",7:"0111011",8:"0110111",9:"0001011"},t={0:"0100111",1:"0110011",2:"0011011",3:"0100001",4:"0011101",5:"0111001",6:"0000101",7:"0010001",8:"0001001",9:"0010111"},r={0:"1110010",1:"1100110",2:"1101100",3:"1000010",4:"1011100",5:"1001110",6:"1010000",7:"1000100",8:"1001000",9:"1110100"},G={0:"LLLLLL",1:"LLGLGG",2:"LLGGLG",3:"LLGGGL",4:"LGLLGG",5:"LGGLLG",6:"LGGGLL",7:"LGLGLG",8:"LGLGGL",9:"LGGLGL"},e="101",i="101",u="01010",s=/^[0-9]{13}$/;function o(n,G){for(var e="",i=0;i<n.length;i++)"L"==G[i]?e+=L[n[i]]:"G"==G[i]?e+=t[n[i]]:"R"==G[i]&&(e+=r[n[i]]);return e}function a(n){return-1!=n.search(s)&&n[12]==function(n){for(var L=0,t=0;t<12;t+=2)L+=parseInt(n[t]);for(t=1;t<12;t+=2)L+=3*parseInt(n[t]);return(10-L%10)%10}(n)}}function UPC(n){this.ean=new EAN("0"+n),this.valid=function(){return this.ean.valid()},this.encoded=function(){return this.ean.encoded()}}