DEV: Remove String.endsWith polyfill (#106)

Discourse no longer supports internet explorer. This function is supported natively on all browsers Discourse currently targets.
This commit is contained in:
David Taylor 2021-04-08 17:46:43 +01:00 committed by GitHub
parent 82cb3ac2fe
commit 563251d608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 13 deletions

View File

@ -2,18 +2,5 @@ export default {
name: "initialize-data-explorer",
initialize(container) {
container.lookup("store:main").addPluralization("query", "queries");
if (!String.prototype.endsWith) {
// eslint-disable-next-line no-extend-native
String.prototype.endsWith = function (searchString, position) {
const subjectString = this.toString();
if (position === undefined || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
const lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
};
}
},
};