KOSASIH / SilkRoad

Prefer not to extend native types JS-0061
Anti-pattern
Minor
8 months agoa year old
String prototype is read only, properties should not be added
 1623	}
 1624	
 1625	if (! String.prototype.includes) {
 1626		String.prototype.includes = _includes; 1627	}
 1628	
 1629	/**
String prototype is read only, properties should not be added
 1617	// .trim() polyfill
 1618	// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim
 1619	if (!String.prototype.trim) {
 1620	  String.prototype.trim = function () { 1621	    return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); 1622	  }; 1623	}
 1624	
 1625	if (! String.prototype.includes) {
Array prototype is read only, properties should not be added
 1611	}
 1612	
 1613	if (! Array.prototype.includes) {
 1614		Array.prototype.includes = _includes; 1615	}
 1616	
 1617	// .trim() polyfill
String prototype is read only, properties should not be added
 1611	}
 1612	
 1613	if (! String.prototype.includes) {
 1614		String.prototype.includes = _includes; 1615	}
 1616	
 1617	/**
String prototype is read only, properties should not be added
 1605	// .trim() polyfill
 1606	// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim
 1607	if (!String.prototype.trim) {
 1608	  String.prototype.trim = function () { 1609	    return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); 1610	  }; 1611	}
 1612	
 1613	if (! String.prototype.includes) {