Parse and manage orienteering split times data with Javascript/Typescript
deno add @orienteering-js/split-timesnpx jsr add @orienteering-js/split-timesyarn dlx jsr add @orienteering-js/split-timespnpm dlx jsr add @orienteering-js/split-timesbunx jsr add @orienteering-js/split-timesimport { parseIofXmlSplitTimesFile } from "@orienteering-js/split-times";
import { readFileSync } from "node:fs";
const iofXmlSplitTimesFile = readFileSync("file.xml");
const xmlDocument = new DOMParser().parseFromString(
iofXmlSplitTimesFile,
"text/xml",
);
const [runners, error] = parseIofXmlSplitTimesFile(
xmlDocument,
"H21",
"+02:00",
"2024-05-14",
);
if (error !== null) {
runners.forEach((runner) => {
console.log(runner.time);
});
}