cyp/app/js/parser.js
Ondrej Zara 17b5040766 art
2019-03-19 22:56:39 +01:00

10 lines
273 B
JavaScript

export function linesToStruct(lines) {
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;
}