Parse and manage orienteering split times data with Javascript/Typescript
deno add @orienteering-js/split-times
npx jsr add @orienteering-js/split-times
yarn dlx jsr add @orienteering-js/split-times
pnpm dlx jsr add @orienteering-js/split-times
bunx jsr add @orienteering-js/split-times
import { 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);
});
}