mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 00:56:13 +01:00
refactor: remove startsWith/endsWith
This commit is contained in:
@@ -769,27 +769,5 @@
|
||||
},
|
||||
};
|
||||
|
||||
/* eslint "no-extend-native": "off" */
|
||||
if (typeof String.prototype.startsWith !== 'function') {
|
||||
String.prototype.startsWith = function (prefix) {
|
||||
if (this.length < prefix.length) {
|
||||
return false;
|
||||
}
|
||||
return this.slice(0, prefix.length) === prefix;
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof String.prototype.endsWith !== 'function') {
|
||||
String.prototype.endsWith = function (suffix) {
|
||||
if (this.length < suffix.length) {
|
||||
return false;
|
||||
}
|
||||
if (suffix.length === 0) {
|
||||
return true;
|
||||
}
|
||||
return this.slice(-suffix.length) === suffix;
|
||||
};
|
||||
}
|
||||
|
||||
return utils;
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user