mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
26 lines
659 B
JavaScript
26 lines
659 B
JavaScript
"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
|
|
};
|
|
}
|