UNPKG

landers.base

Version:

landers.base

18 lines (15 loc) 538 B
String.prototype.trim = String.prototype.trim || function(){ return this.replace(/^\s+|\s+$/gm,''); }; String.prototype.replaceAll = String.prototype.replaceAll || function(s1, s2){ s1 = s1.replace(/\{/,'\\{').replace(/\}/,'\\}'); var re = new RegExp(s1, "gi"); return this.replace(re, s2); }; Array.prototype.last = Array.prototype.last || function(){ return this[this.length - 1]; }; // ie11不支持find Array.prototype.find = Array.prototype.find || function (callback) { return this.filter(callback)[0]; };