mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-20 16:00:13 +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
|
|
@ -14,6 +14,18 @@ module.exports.inlineCommentRe = inlineCommentRe;
|
|||
// readFile options for reading with the UTF-8 encoding
|
||||
module.exports.utf8Encoding = { "encoding": "utf8" };
|
||||
|
||||
// Trims whitespace from the left (start) of a string
|
||||
function trimLeft(str) {
|
||||
return str.replace(/^\s*/, "");
|
||||
}
|
||||
module.exports.trimLeft = trimLeft;
|
||||
|
||||
// Trims whitespace from the right (end) of a string
|
||||
function trimRight(str) {
|
||||
return str.replace(/\s*$/, "");
|
||||
}
|
||||
module.exports.trimRight = trimRight;
|
||||
|
||||
// Applies key/value pairs from src to dst, returning dst
|
||||
function assign(dst, src) {
|
||||
Object.keys(src).forEach(function forKey(key) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue