getEol.js 771 Bytes
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//return first eol found from a data chunk.
function default_1(data, param) {
    if (!param.eol && data) {
        for (var i = 0, len = data.length; i < len; i++) {
            if (data[i] === "\r") {
                if (data[i + 1] === "\n") {
                    param.eol = "\r\n";
                    break;
                }
                else if (data[i + 1]) {
                    param.eol = "\r";
                    break;
                }
            }
            else if (data[i] === "\n") {
                param.eol = "\n";
                break;
            }
        }
    }
    return param.eol || "\n";
}
exports.default = default_1;
;
//# sourceMappingURL=getEol.js.map