FIX: Polyfill String.startsWith function for IE11

Followup to fe0d912b97985a6272e720729aa6197e8e40274f
This commit is contained in:
David Taylor
2020-02-11 15:35:22 +00:00
parent d294e13225
commit b34f09f8d7

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 * Symbol-ES6 v0.1.2
* ES6 Symbol polyfill in pure ES5. * ES6 Symbol polyfill in pure ES5.