1 line
869 B
JavaScript
1 line
869 B
JavaScript
String.prototype.includes||(String.prototype.includes=function(search,start){if(search instanceof RegExp)throw TypeError("first argument must not be a RegExp");return-1!==this.indexOf(search,start=void 0===start?0:start)}),String.prototype.startsWith||Object.defineProperty(String.prototype,"startsWith",{value:function(search,rawPos){rawPos=0<rawPos?0|rawPos:0;return this.substring(rawPos,rawPos+search.length)===search}}),String.prototype.endsWith||(String.prototype.endsWith=function(search,this_len){return(void 0===this_len||this_len>this.length)&&(this_len=this.length),this.substring(this_len-search.length,this_len)===search}),String.prototype.replaceAll||(String.prototype.replaceAll=function(find,replace){for(var index,next,s="";~(next=this.indexOf(find,index));)s+=this.substring(index,next)+replace,index=next+find.length;return s+this.substring(index)}); |