diff --git a/index.js b/index.js index 8aa707c..03f30f3 100644 --- a/index.js +++ b/index.js @@ -102,9 +102,9 @@ const findLongestLine = (text, opts) => { return max } -const padLine = (line, padding) => { +const padLine = (line, padding, trailingSpace) => { const padStr = String().padStart(padding, ' ') - return padStr + line + padStr + return padStr + line + (trailingSpace ? padStr : '') } const getIndentStr = opts => { @@ -307,7 +307,9 @@ const cropPadAndNumber = (text, opts) => { const plain = stripAnsi(line).replace(/\t/g, '') const linePad = String().padEnd((longestLineLen - plain.length) - tabAdjust, ' ') - const runLengthLine = line + opts.colors.trailingSpace(linePad) + const runLengthLine = opts.trailingSpace ? + line + opts.colors.trailingSpace(linePad) : + line let lineOutput @@ -316,7 +318,7 @@ const cropPadAndNumber = (text, opts) => { } if (typeof opts.tabsToSpaces === 'number') { - lineOutput = lineNo + padLine(runLengthLine, opts.codePad) + lineOutput = lineNo + padLine(runLengthLine, opts.codePad, opts.trailingSpace) } output += lineOutput + '\n' @@ -356,7 +358,8 @@ const procOpts = (opts = {}) => { colors: darkPalette, tabsToSpaces: 4, consoleTabWidth: 8, - arrowKeyword: 'const' + arrowKeyword: 'const', + trailingSpace: true } options = merge(options, opts) diff --git a/package.json b/package.json index 94d847a..65a2a4d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "detect-indent": "^5.0.0", "he": "^1.1.1", "highlight.js": "^9.12.0", - "husky": "^0.14.3", "min-indent": "^1.0.0", "strip-ansi": "^4.0.0", "strip-indent": "^2.0.0", @@ -36,6 +35,7 @@ "devDependencies": { "ava": "^0.25.0", "coveralls": "^3.0.0", + "husky": "^0.14.3", "nyc": "^11.6.0", "xo": "^0.20.3" },