import { parse } from "https://deno.land/std@0.218.2/toml/mod.ts";
import { match } from "npm:ts-pattern@5.0.8";
// suppose options.config might be either string or undefined
const readToml = match(options.config)
.with(P.string, async (configPath) => {
return parse(await Deno.readTextFile(configPath));
})
// deno-lint-ignore require-await
.with(undefined, async () => ({}))
.exhaustive();
console.log(await readToml);
import { parse } from "https://deno.land/std@0.218.2/toml/mod.ts";
import { match } from "npm:ts-pattern@5.0.8";
// suppose options.config might be either string or undefined
const readToml = match(options.config)
.with(P.string, async (configPath) => {
return parse(await Deno.readTextFile(configPath));
})
// deno-lint-ignore require-await
.with(undefined, async () => ({}))
.exhaustive();
console.log(await readToml);