diff --git a/docs/index.html b/docs/index.html index fe57e2755..2be8f92ee 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1131,16 +1131,16 @@ const JSONToFile = (obj, filename) => fs.writeFile(`${filename}.json`, JSON.s convert buffer to string using toString(encoding) function. creating an array from contents of file by spliting file content line by line (each \n).

const fs = require('fs');
-const readFileLines = filename => fs.readFileSync(filename).toString('UTF8').split('\n');
+const readFileLines = filename => fs.readFileSync(filename).toString('UTF8').split(/\r?\n/);
 /*
-contents of test.txt :
-  line1
-  line2
-  line3
-  ___________________________
-let arr = readFileLines('test.txt')
-console.log(arr) // -> ['line1', 'line2', 'line3']
-*/
+  contents of test.txt :
+    line1
+    line2
+    line3
+    ___________________________
+  let arr = readFileLines('test.txt')
+  console.log(arr) // -> ['line1', 'line2', 'line3']
+ */
 

Object

cleanObj