From e4454c7e94f9bcb6db9c50a0bc5ce4aa0474115b Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Sat, 23 Sep 2017 14:15:54 +0200 Subject: [PATCH] all-in-one: remove unnecessary blank lines from build output --- allinone/build.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/allinone/build.js b/allinone/build.js index fd4fa88..570a90d 100644 --- a/allinone/build.js +++ b/allinone/build.js @@ -114,4 +114,15 @@ restart: for (var lno = 0; lno < source.length;) { lno++; } -console.log(source.join('\n')); +var emptyOk = false; +for (var i = 0; i < source.length; i++) { + var line = source[i].replace(/\s+$/, ''); + if (line === '') { + if (emptyOk) + process.stdout.write('\n'); + emptyOk = false; + } else { + process.stdout.write(line + '\n'); + emptyOk = true; + } +}