// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

import { ParserFactory, Toml } from "./_parser.ts";

/**
 * Parse parses TOML string into an object.
 *
 * @example Decode TOML string
 * ```ts
 * import { parse } from "@std/toml/parse";
 * import { assertEquals } from "@std/assert/assert-equals"
 *
 * const tomlString = `title = "TOML Example"
 * [owner]
 * name = "Alice"
 * bio = "Alice is a programmer."`;
 *
 * const obj = parse(tomlString);
 * assertEquals(obj, { title: "TOML Example", owner: { name: "Alice", bio: "Alice is a programmer." } });
 * ```
 * @param tomlString TOML string to be parsed.
 * @returns The parsed JS object.
 */
export const parse: (tomlString: string) => Record<string, unknown> =
  ParserFactory(Toml);

// denoCacheMetadata={"headers":{"cf-ray":"a223e656afca7db6-LAX","date":"Tue, 28 Jul 2026 12:31:15 GMT","vary":"Origin","x-robots-tag":"noindex","content-length":"804","access-control-allow-origin":"*","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","access-control-expose-headers":"*","cross-origin-resource-policy":"cross-origin","x-content-type-options":"nosniff","server":"cloudflare","etag":"\"be0e43d899b91fe330d842b80eb7e875\"","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=fiYG4K%2FIVPbkgP%2BxFmFRPs%2FGlX4598LGfPwdyyhSzzeIv29h%2Fgq3T%2F%2Ba3VAbTix%2BJPiTC7a2QRocYXvCENNy1it4PXbTB4GauAlagTj%2FIcs9JrjNwWxyGYQ%3D\"}]}","x-jsr-backend":"modules","content-type":"text/typescript","set-cookie":"__cf_bm=ag.tbybFRKZHhcllkVjBkSHjcXWU12SZEmj5IyuOrSo-1785241874.9956224-1.0.1.1-tW6ZloAbNCwilhrSGgozQLdIkyq.Rp61QWpCJveRqeJ6QvoE4Qlckxxp129txAkFyL8q18sQ0eYcoLQP3aTCultoMQ6WMe_.embxXSZWJI08E7EzsLgkqBX4dLXtILH8; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","cache-control":"public, max-age=31536000, immutable","alt-svc":"h3=\":443\"; ma=86400"},"url":"https://jsr.io/@std/toml/0.224.1/parse.ts","time":1785241875}