You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
620 B
JavaScript

import { SameLine as _ } from "../../peg-whitespace"
import { RestOfLine } from "../../peg-rest-of-line"
{
const syncpipe = require("syncpipe");
const mapVersionTitle = require("../map-version-title");
}
Output
= entries:VersionLine+ {
// FIXME/MARKER: Build a generic abstraction for fromNamedEntries or so
return syncpipe(entries, [
(_) => _.map(({ key, value }) => [ key, value ]),
(_) => Object.fromEntries(_)
]);
}
VersionLine
= _ label:$[A-Za-z ]+ ":" _ version:RestOfLine {
return {
key: mapVersionTitle(label), // FIXME/MARKER: Rename to mapVersionLabel
value: version.trim()
};
}