refactor(common): refactor polyfill of String.prototype.includes
This commit is contained in:
parent
f4c21a0cb2
commit
b1fa8c098b
@ -2,17 +2,9 @@
|
||||
|
||||
// polyfill of String.prototype.includes
|
||||
if (!String.prototype.includes) {
|
||||
String.prototype.includes = function(search, start) {
|
||||
'use strict';
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > this.length) {
|
||||
return false;
|
||||
} else {
|
||||
return this.indexOf(search, start) !== -1;
|
||||
}
|
||||
String.prototype.includes = function(search) {
|
||||
// Copied from core-js
|
||||
return !!~this.indexOf(search, arguments.length > 1 ? arguments[1] : undefined);
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user