FIX: Polyfill String.startsWith function for IE11

Followup to fe0d912b97
This commit is contained in:
David Taylor 2020-02-11 15:35:22 +00:00
parent d294e13225
commit b34f09f8d7
1 changed files with 10 additions and 0 deletions

View File

@ -321,6 +321,16 @@ if (!String.prototype.repeat) {
};
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Polyfill
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, "startsWith", {
value: function(search, rawPos) {
var pos = rawPos > 0 ? rawPos | 0 : 0;
return this.substring(pos, pos + search.length) === search;
}
});
}
/*!
* Symbol-ES6 v0.1.2
* ES6 Symbol polyfill in pure ES5.