mirror of
https://github.com/beautifier/js-beautify.git
synced 2025-03-03 18:47:58 +00:00
CLI: do not breed duplicate eof newlines #325
This commit is contained in:
parent
790f07a2bb
commit
7693fc8c81
@ -256,7 +256,9 @@ function makePretty(code, config, outfile, callback) {
|
|||||||
var pretty = beautify[fileType](code, config);
|
var pretty = beautify[fileType](code, config);
|
||||||
|
|
||||||
// ensure newline at end of beautified output
|
// ensure newline at end of beautified output
|
||||||
pretty += '\n';
|
if (pretty && pretty.charAt(pretty.length - 1) !== '\n') {
|
||||||
|
pretty += '\n';
|
||||||
|
}
|
||||||
|
|
||||||
callback(null, pretty, outfile, config);
|
callback(null, pretty, outfile, config);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user