os#EOL JavaScript Examples

The following examples show how to use os#EOL. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: dsv2json.js    From cs-wiki with GNU General Public License v3.0 6 votes vote down vote up
rw.dash.readFile(program.args[0] || "-", (error, text) => {
  if (error) throw error;
  const rowConverter = options.autoType ? dsv.autoType : null
  const rows = inFormat.parse(iconv.decode(text, options.inputEncoding), rowConverter);
  rw.dash.writeFile(options.out, iconv.encode(options.newlineDelimited
      ? rows.map((row) => JSON.stringify(row)).join("\n") + "\n"
      : JSON.stringify(rows) + EOL, options.outputEncoding), (error) => {
    if (error) throw error;
  });
});
Example #2
Source File: json2dsv.js    From cs-wiki with GNU General Public License v3.0 6 votes vote down vote up
rw.dash.readFile(program.args[0] || "-", (error, text) => {
  if (error) throw error;
  text = iconv.decode(text, options.inputEncoding);
  rw.dash.writeFile(options.out, iconv.encode(outFormat.format(options.newlineDelimited
      ? text.trim().split(/\r?\n/g).map((line) => JSON.parse(line))
      : JSON.parse(text)) + EOL, options.outputEncoding), (error) => {
    if (error) throw error;
  });
});
Example #3
Source File: getTmpFile.js    From fes.js with MIT License 6 votes vote down vote up
function getExtraImports(models = [], absSrcPath) {
    const extraModels = genExtraModels(models, absSrcPath);
    return extraModels
        .map((ele) => {
            if (ele.exportName) {
                return `import { ${ele.exportName} } from '${winPath(
                    ele.importPath.replace(/'/g, "\\'")
                )}';`;
            }
            return `import ${ele.importName} from '${winPath(
                ele.importPath.replace(/'/g, "\\'")
            )}';`;
        })
        .join(EOL);
}
Example #4
Source File: dsv2dsv.js    From cs-wiki with GNU General Public License v3.0 5 votes vote down vote up
rw.dash.readFile(program.args[0] || "-", (error, text) => {
  if (error) throw error;
  rw.dash.writeFile("-", iconv.encode(outFormat.format(inFormat.parse(iconv.decode(text, options.inputEncoding))) + EOL, options.outputEncoding), (error) => {
    if (error) throw error;
  });
});
Example #5
Source File: index.js    From fes.js with MIT License 5 votes vote down vote up
genImports = imports => imports
    .map(
        (ele, index) => `import model${index} from "${winPath(getPath(ele))}";`
    )
    .join(EOL)
Example #6
Source File: log.js    From action-install-gh-release with Apache License 2.0 5 votes vote down vote up
export function log(message, ...args) {
    process.stderr.write(`${util.format(message, ...args)}${EOL}`);
}