How to use the EOL function from os

Find comprehensive JavaScript os.EOL code examples handpicked from public code repositorys.

1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
    return ascObj;
},

getEOL: function(content) {
    if (!content) {
        return os.EOL;
    }
    const nIndex = content.lastIndexOf('\n');
    if (nIndex === -1) {
        return os.EOL;
fork icon0
star icon1
watch icon1

222
223
224
225
226
227
228
229
230
231
  appPackage[key] = templatePackage[key];
});

fs.writeFileSync(
  path.join(appPath, 'package.json'),
  JSON.stringify(appPackage, null, 2) + os.EOL
);

const readmeExists = fs.existsSync(path.join(appPath, 'README.md'));
if (readmeExists) {
fork icon0
star icon0
watch icon2

+ 2 other calls in file

697
698
699
700
701
702
703
704
705
706
707
  };
})();


let writeFilePreservingEol = exports.writeFilePreservingEol = (() => {
  var _ref17 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (path, data) {
    const eol = (yield getEolFromFile(path)) || os.EOL;
    if (eol !== '\n') {
      data = data.replace(/\n/g, eol);
    }
    yield (0, (_promise2 || _load_promise2()).promisify)(fs.writeFile)(path, data);
fork icon0
star icon0
watch icon1

275
276
277
278
279
280
281
282
283
284
  version: '0.1.0',
  private: true,
};
fs.writeFileSync(
  path.join(root, 'package.json'),
  JSON.stringify(packageJson, null, 2) + os.EOL
);

const originalDirectory = process.cwd();
/** !!!注意,切换脚本工作目录到当前项目目录里(原cwd + 项目名 的路径) */
fork icon0
star icon0
watch icon1

199
200
201
202
203
204
205
206
207
208
    if (line.indexOf(mode.end) > -1) {
        accountSimpleCount = -1;
        continue;
    }
    accountSimpleCount--;
    obj.notifyContent = obj.notifyContent + line + os.EOL;
}

if (accountSimpleCount == -1 && line.indexOf(mode.start) > -1) {
    // console.log('京东账号:' + line);
fork icon0
star icon0
watch icon1

90
91
92
93
94
95
96
97
98
99
};

const formatDiagnosticHost = {
  getCanonicalFileName: (fileName) => fileName,
  getCurrentDirectory: ts.sys.getCurrentDirectory,
  getNewLine: () => os.EOL
};

const messages = [];
let appTsConfig;
fork icon0
star icon0
watch icon12