Skip to content

Commit

Permalink
Avoid extra trailing whitespace in stdout mode
Browse files Browse the repository at this point in the history
Not only does `console.log()` already print a newline after its output,
but it prints a space between each of its arguments, so including `'\n'`
as a second argument results in a trailing space, then a newline, then
another newline. Excluding this extra `'\n'` results in just one newline
after the data.
  • Loading branch information
corpulentcoffee authored and GreLI committed Nov 7, 2017
1 parent 7797bba commit efcb07e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/svgo/coa.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function processSVGData(config, info, data, output, input) {
*/
function writeOutput(input, output, data) {
if (output == '-') {
console.log(data, '\n');
console.log(data);
return Promise.resolve();
}
return writeFile(output, data, 'utf8').catch(error => checkWriteFileError(input, output, data, error));
Expand Down

0 comments on commit efcb07e

Please sign in to comment.