UNPKG

import-conductor

Version:

Automatically organize your Typescript import statements

16 lines 579 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.detectLineEnding = void 0; exports.detectLineEnding = (value) => { if (typeof value !== 'string') { throw new TypeError('Expected a string for new line detection'); } const newlines = value.match(/(?:\r?\n)/g) || []; if (newlines.length === 0) { return; } const crlf = newlines.filter((newline) => newline === '\r\n').length; const lf = newlines.length - crlf; return crlf > lf ? '\r\n' : '\n'; }; //# sourceMappingURL=line-ending-detector.js.map