mirror of
https://github.com/wahyd4/cdnjs.git
synced 2026-08-22 03:06:20 +10:00
1 line
5.2 KiB
JavaScript
1 line
5.2 KiB
JavaScript
((function(){function f(a,b){var c={},d={},e,f={},g={},h={},i={};f[0]="HTML_SPECIALCHARS",f[1]="HTML_ENTITIES",g[0]="ENT_NOQUOTES",g[2]="ENT_COMPAT",g[3]="ENT_QUOTES",h=isNaN(a)?a?a.toUpperCase():"HTML_SPECIALCHARS":f[a],i=isNaN(b)?b?b.toUpperCase():"ENT_COMPAT":g[b];if(h!=="HTML_SPECIALCHARS"&&h!=="HTML_ENTITIES")throw new Error("Table: "+h+" not supported");c[38]="&",h==="HTML_ENTITIES"&&(c[160]=" ",c[161]="¡",c[162]="¢",c[163]="£",c[164]="¤",c[165]="¥",c[166]="¦",c[167]="§",c[168]="¨",c[169]="©",c[170]="ª",c[171]="«",c[172]="¬",c[173]="­",c[174]="®",c[175]="¯",c[176]="°",c[177]="±",c[178]="²",c[179]="³",c[180]="´",c[181]="µ",c[182]="¶",c[183]="·",c[184]="¸",c[185]="¹",c[186]="º",c[187]="»",c[188]="¼",c[189]="½",c[190]="¾",c[191]="¿",c[192]="À",c[193]="Á",c[194]="Â",c[195]="Ã",c[196]="Ä",c[197]="Å",c[198]="Æ",c[199]="Ç",c[200]="È",c[201]="É",c[202]="Ê",c[203]="Ë",c[204]="Ì",c[205]="Í",c[206]="Î",c[207]="Ï",c[208]="Ð",c[209]="Ñ",c[210]="Ò",c[211]="Ó",c[212]="Ô",c[213]="Õ",c[214]="Ö",c[215]="×",c[216]="Ø",c[217]="Ù",c[218]="Ú",c[219]="Û",c[220]="Ü",c[221]="Ý",c[222]="Þ",c[223]="ß",c[224]="à",c[225]="á",c[226]="â",c[227]="ã",c[228]="ä",c[229]="å",c[230]="æ",c[231]="ç",c[232]="è",c[233]="é",c[234]="ê",c[235]="ë",c[236]="ì",c[237]="í",c[238]="î",c[239]="ï",c[240]="ð",c[241]="ñ",c[242]="ò",c[243]="ó",c[244]="ô",c[245]="õ",c[246]="ö",c[247]="÷",c[248]="ø",c[249]="ù",c[250]="ú",c[251]="û",c[252]="ü",c[253]="ý",c[254]="þ",c[255]="ÿ"),i!=="ENT_NOQUOTES"&&(c[34]="""),i==="ENT_QUOTES"&&(c[39]="'"),c[60]="<",c[62]=">";for(e in c)c.hasOwnProperty(e)&&(d[String.fromCharCode(e)]=c[e]);return d}var a,b,c,d,e;a=function(){function a(a){this.s=a,this.s==null&&(this.s=this)}return a.prototype.camelize=function(){var b;return b=this.trim().s.replace(/(\-|_|\s)+(.)?/g,function(a,b,c){return c?c.toUpperCase():""}),new a(b)},a.prototype.capitalize=function(){return new a(this.s.substr(0,1).toUpperCase()+this.s.substring(1).toLowerCase())},a.prototype.collapseWhitespace=function(){var b;return b=this.s.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,""),new a(b)},a.prototype.contains=function(a){return this.s.indexOf(a)>=0},a.prototype.dasherize=function(){var b;return b=this.trim().s.replace(/[_\s]+/g,"-").replace(/([A-Z])/g,"-$1").replace(/-+/g,"-").toLowerCase(),new a(b)},a.prototype.decodeHtmlEntities=function(b){var c,d,e,g;d={},e=c="",g=this.s;if(!1===(d=f("HTML_ENTITIES",b)))return!1;delete d["&"],d["&"]="&",console.log(g);for(e in d)c=d[e],g=g.split(c).join(e);return g=g.split("'").join("'"),new a(g)},a.prototype.endsWith=function(a){var b;return b=this.s.length-a.length,b>=0&&this.s.indexOf(a,b)===b},a.prototype.isAlpha=function(){return!/[^a-zA-Z]/.test(this.s)},a.prototype.isAlphaNumeric=function(){return!/[^a-zA-Z0-9]/.test(this.s)},a.prototype.isEmpty=function(){return/^[\s\xa0]*$/.test(this.s)},a.prototype.isLower=function(){return!/[^a-z]/.test(this.s)},a.prototype.isNumeric=function(){return!/[^0-9]/.test(this.s)},a.prototype.isUpper=function(){return!/[^A-Z]/.test(this.s)},a.prototype.left=function(b){var c;return b>=2?(c=this.s.substr(0,b),new a(c)):this.right(-b)},a.prototype.ltrim=function(){var b;return b=this.s.replace(/(^\s*)/g,""),new a(b)},a.prototype.replaceAll=function(b,c){var d;return d=this.s.replace(new RegExp(b,"g"),c),new a(d)},a.prototype.right=function(b){var c;return b>=0?(c=this.s.substr(this.s.length-b,b),new a(c)):this.left(-b)},a.prototype.rtrim=function(){var b;return b=this.s.replace(/\s+$/,""),new a(b)},a.prototype.startsWith=function(a){return this.s.lastIndexOf(a,0)===0},a.prototype.times=function(b){return new a((new Array(b+1)).join(this.s))},a.prototype.trim=function(){var b;return typeof String.prototype.trim=="undefined"?b=this.s.replace(/(^\s*|\s*$)/g,""):b=this.s.trim(),new a(b)},a.prototype.toString=function(){return this.s},a.prototype.underscore=function(){var b;return b=this.trim().s.replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase(),(new a(this.s.charAt(0))).isUpper()&&(b="_"+b),new a(b)},a.prototype.repeat=a.prototype.times,a.prototype.include=a.prototype.contains,a}(),e=function(b){return new a(b)},c=[],b=function(){var b,d,e,f;e=new a,f=[];for(d in e)b=e[d],String.prototype.hasOwnProperty(d)?f.push(void 0):(c.push(d),f.push(String.prototype[d]=function(){return String.prototype.s=this,b.apply(this,arguments)}));return f},d=function(){var a,b,d;for(b=0,d=c.length;b<d;b++)a=c[b],delete String.prototype[a];return c.length=0},typeof window!="undefined"&&window!==null?(window.S=e,window.S.clobberPrototype=b,window.S.restorePrototype=d):(module.exports=e,module.exports.clobberPrototype=b,module.exports.restorePrototype=d)})).call(this); |