mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-03-09 03:42:34 +01:00
Replace trimLeft/trimRight polyfills with helper methods.
This commit is contained in:
parent
39d39db961
commit
1184281c87
5 changed files with 21 additions and 36 deletions
|
|
@ -1,26 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
// Polyfills for browsers that do not support String.trimLeft/Right
|
||||
function trimLeftPolyfill() {
|
||||
return this.replace(/^\s*/, "");
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (!String.prototype.trimLeft) {
|
||||
String.prototype.trimLeft = trimLeftPolyfill;
|
||||
}
|
||||
function trimRightPolyfill() {
|
||||
return this.replace(/\s*$/, "");
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (!String.prototype.trimRight) {
|
||||
String.prototype.trimRight = trimRightPolyfill;
|
||||
}
|
||||
|
||||
// Export for testing
|
||||
/* istanbul ignore else */
|
||||
if ((typeof module !== "undefined") && module.exports) {
|
||||
module.exports = {
|
||||
"trimLeftPolyfill": trimLeftPolyfill,
|
||||
"trimRightPolyfill": trimRightPolyfill
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue