cyp/app/js/parser.js
Ondrej Zara 860ad33a70 first
2019-03-19 20:45:23 +01:00

11 lines
295 B
JavaScript

export function linesToStruct(lines) {
lines.pop(); // "OK"
let result = {};
lines.forEach(line => {
let cindex = line.indexOf(":");
if (cindex == -1) { throw new Error(`Malformed line "${line}"`); }
result[line.substring(0, cindex)] = line.substring(cindex+2);
});
return result;
}