@handfish/hygen
Version:
The scalable code generator that saves you time.
14 lines • 466 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const os_1 = require("os");
const newline = string => {
const newlines = string.match(/(?:\r?\n)/g) || [];
if (newlines.length === 0) {
return os_1.EOL;
}
const crlf = newlines.filter(newline => newline === '\r\n').length;
const lf = newlines.length - crlf;
return crlf > lf ? '\r\n' : '\n';
};
exports.default = newline;
//# sourceMappingURL=newline.js.map