Files
cdnjs/ajax/libs/string.js/0.2.2/string.min.js
T

2 lines
5.2 KiB
JavaScript

// Generated by CoffeeScript 1.3.3
(function(){function s(e,t){var n={},r={},i,s={},o={},u={},a={};s[0]="HTML_SPECIALCHARS",s[1]="HTML_ENTITIES",o[0]="ENT_NOQUOTES",o[2]="ENT_COMPAT",o[3]="ENT_QUOTES",u=isNaN(e)?e?e.toUpperCase():"HTML_SPECIALCHARS":s[e],a=isNaN(t)?t?t.toUpperCase():"ENT_COMPAT":o[t];if(u!=="HTML_SPECIALCHARS"&&u!=="HTML_ENTITIES")throw new Error("Table: "+u+" not supported");n[38]="&amp;",u==="HTML_ENTITIES"&&(n[160]="&nbsp;",n[161]="&iexcl;",n[162]="&cent;",n[163]="&pound;",n[164]="&curren;",n[165]="&yen;",n[166]="&brvbar;",n[167]="&sect;",n[168]="&uml;",n[169]="&copy;",n[170]="&ordf;",n[171]="&laquo;",n[172]="&not;",n[173]="&shy;",n[174]="&reg;",n[175]="&macr;",n[176]="&deg;",n[177]="&plusmn;",n[178]="&sup2;",n[179]="&sup3;",n[180]="&acute;",n[181]="&micro;",n[182]="&para;",n[183]="&middot;",n[184]="&cedil;",n[185]="&sup1;",n[186]="&ordm;",n[187]="&raquo;",n[188]="&frac14;",n[189]="&frac12;",n[190]="&frac34;",n[191]="&iquest;",n[192]="&Agrave;",n[193]="&Aacute;",n[194]="&Acirc;",n[195]="&Atilde;",n[196]="&Auml;",n[197]="&Aring;",n[198]="&AElig;",n[199]="&Ccedil;",n[200]="&Egrave;",n[201]="&Eacute;",n[202]="&Ecirc;",n[203]="&Euml;",n[204]="&Igrave;",n[205]="&Iacute;",n[206]="&Icirc;",n[207]="&Iuml;",n[208]="&ETH;",n[209]="&Ntilde;",n[210]="&Ograve;",n[211]="&Oacute;",n[212]="&Ocirc;",n[213]="&Otilde;",n[214]="&Ouml;",n[215]="&times;",n[216]="&Oslash;",n[217]="&Ugrave;",n[218]="&Uacute;",n[219]="&Ucirc;",n[220]="&Uuml;",n[221]="&Yacute;",n[222]="&THORN;",n[223]="&szlig;",n[224]="&agrave;",n[225]="&aacute;",n[226]="&acirc;",n[227]="&atilde;",n[228]="&auml;",n[229]="&aring;",n[230]="&aelig;",n[231]="&ccedil;",n[232]="&egrave;",n[233]="&eacute;",n[234]="&ecirc;",n[235]="&euml;",n[236]="&igrave;",n[237]="&iacute;",n[238]="&icirc;",n[239]="&iuml;",n[240]="&eth;",n[241]="&ntilde;",n[242]="&ograve;",n[243]="&oacute;",n[244]="&ocirc;",n[245]="&otilde;",n[246]="&ouml;",n[247]="&divide;",n[248]="&oslash;",n[249]="&ugrave;",n[250]="&uacute;",n[251]="&ucirc;",n[252]="&uuml;",n[253]="&yacute;",n[254]="&thorn;",n[255]="&yuml;"),a!=="ENT_NOQUOTES"&&(n[34]="&quot;"),a==="ENT_QUOTES"&&(n[39]="&#39;"),n[60]="&lt;",n[62]="&gt;";for(i in n)n.hasOwnProperty(i)&&(r[String.fromCharCode(i)]=n[i]);return r}var e,t,n,r,i;e=function(){function e(e){this.s=e,this.s==null&&(this.s=this)}return e.prototype.camelize=function(){var t;return t=this.trim().s.replace(/(\-|_|\s)+(.)?/g,function(e,t,n){return n?n.toUpperCase():""}),new e(t)},e.prototype.capitalize=function(){return new e(this.s.substr(0,1).toUpperCase()+this.s.substring(1).toLowerCase())},e.prototype.collapseWhitespace=function(){var t;return t=this.s.replace(/[\s\xa0]+/g," ").replace(/^\s+|\s+$/g,""),new e(t)},e.prototype.contains=function(e){return this.s.indexOf(e)>=0},e.prototype.dasherize=function(){var t;return t=this.trim().s.replace(/[_\s]+/g,"-").replace(/([A-Z])/g,"-$1").replace(/-+/g,"-").toLowerCase(),new e(t)},e.prototype.decodeHtmlEntities=function(t){var n,r,i,o;r={},i=n="",o=this.s;if(!1===(r=s("HTML_ENTITIES",t)))return!1;delete r["&"],r["&"]="&amp;";for(i in r)n=r[i],o=o.split(n).join(i);return o=o.split("&#039;").join("'"),new e(o)},e.prototype.endsWith=function(e){var t;return t=this.s.length-e.length,t>=0&&this.s.indexOf(e,t)===t},e.prototype.isAlpha=function(){return!/[^a-zA-Z]/.test(this.s)},e.prototype.isAlphaNumeric=function(){return!/[^a-zA-Z0-9]/.test(this.s)},e.prototype.isEmpty=function(){return/^[\s\xa0]*$/.test(this.s)},e.prototype.isLower=function(){return!/[^a-z]/.test(this.s)},e.prototype.isNumeric=function(){return!/[^0-9]/.test(this.s)},e.prototype.isUpper=function(){return!/[^A-Z]/.test(this.s)},e.prototype.left=function(t){var n;return t>=0?(n=this.s.substr(0,t),new e(n)):this.right(-t)},e.prototype.ltrim=function(){var t;return t=this.s.replace(/(^\s*)/g,""),new e(t)},e.prototype.replaceAll=function(t,n){var r;return r=this.s.replace(new RegExp(t,"g"),n),new e(r)},e.prototype.right=function(t){var n;return t>=0?(n=this.s.substr(this.s.length-t,t),new e(n)):this.left(-t)},e.prototype.rtrim=function(){var t;return t=this.s.replace(/\s+$/,""),new e(t)},e.prototype.startsWith=function(e){return this.s.lastIndexOf(e,0)===0},e.prototype.times=function(t){return new e((new Array(t+1)).join(this.s))},e.prototype.trim=function(){var t;return typeof String.prototype.trim=="undefined"?t=this.s.replace(/(^\s*|\s*$)/g,""):t=this.s.trim(),new e(t)},e.prototype.toString=function(){return this.s},e.prototype.underscore=function(){var t;return t=this.trim().s.replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase(),(new e(this.s.charAt(0))).isUpper()&&(t="_"+t),new e(t)},e.prototype.repeat=e.prototype.times,e.prototype.include=e.prototype.contains,e}(),i=function(t){return new e(t)},n=[],t=function(){var t,r,i,s;i=new e,s=[];for(r in i)t=i[r],String.prototype.hasOwnProperty(r)?s.push(void 0):(n.push(r),s.push(String.prototype[r]=function(){return String.prototype.s=this,t.apply(this,arguments)}));return s},r=function(){var e,t,r;for(t=0,r=n.length;t<r;t++)e=n[t],delete String.prototype[e];return n.length=0},typeof window!="undefined"&&window!==null?(window.S=i,window.S.clobberPrototype=t,window.S.restorePrototype=r):(module.exports=i,module.exports.clobberPrototype=t,module.exports.restorePrototype=r)}).call(this);