22 lines
No EOL
2.5 KiB
JavaScript
22 lines
No EOL
2.5 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var getEol_1 = __importDefault(require("./getEol"));
|
|
// const getEol = require("./getEol");
|
|
/**
|
|
* convert data chunk to file lines array
|
|
* @param {string} data data chunk as utf8 string
|
|
* @param {object} param Converter param object
|
|
* @return {Object} {lines:[line1,line2...],partial:String}
|
|
*/
|
|
function stringToLines(data, param) {
|
|
var eol = getEol_1.default(data, param);
|
|
var lines = data.split(eol);
|
|
var partial = lines.pop() || "";
|
|
return { lines: lines, partial: partial };
|
|
}
|
|
exports.stringToLines = stringToLines;
|
|
;
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiL1VzZXJzL2t4aWFuZy93b3JrL3Byb2plY3RzL2NzdjJqc29uL3NyYy9maWxlbGluZS50cyIsInNvdXJjZXMiOlsiL1VzZXJzL2t4aWFuZy93b3JrL3Byb2plY3RzL2NzdjJqc29uL3NyYy9maWxlbGluZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUNBLG9EQUE4QjtBQUM5QixzQ0FBc0M7QUFDdEM7Ozs7O0dBS0c7QUFDSCx1QkFBOEIsSUFBWSxFQUFFLEtBQW1CO0lBQzdELElBQU0sR0FBRyxHQUFHLGdCQUFNLENBQUMsSUFBSSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBQ2hDLElBQU0sS0FBSyxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUM7SUFDOUIsSUFBTSxPQUFPLEdBQUcsS0FBSyxDQUFDLEdBQUcsRUFBRSxJQUFJLEVBQUUsQ0FBQztJQUNsQyxPQUFPLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxPQUFPL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