From ec18537d9618ab0a9333ed3114028eb1b4ddf0b7 Mon Sep 17 00:00:00 2001 From: Regin Larsen Date: Wed, 5 Apr 2017 14:37:04 +0200 Subject: [PATCH] Simplify and correct newlines replacement logic on Windows (#1713) --- app/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config.js b/app/config.js index ca244ba2..37c881a6 100644 --- a/app/config.js +++ b/app/config.js @@ -88,7 +88,7 @@ function exec(str) { // to text formatted with DOS line endings. We do this because the default // text editor on Windows (notepad) doesn't Deal with LF files. Still. In 2017. function crlfify(str) { - return str.split('\n').map(x => x.indexOf('\r') < 0 ? x : `${x}\r`).join('\n'); + return str.replace(/\r?\n/g, '\r\n'); } exports.subscribe = function (fn) {