Function stringify

  • Converts an object to a TOML string.

    Parameters

    • obj: Record<string, unknown>

      Source object

    • Optionaloptions: StringifyOptions

      Options for stringifying.

    Returns string

    TOML string

    import { stringify } from "@std/toml/stringify";
    import { assertEquals } from "@std/assert";

    const obj = {
    title: "TOML Example",
    owner: {
    name: "Bob",
    bio: "Bob is a cool guy",
    }
    };
    const tomlString = stringify(obj);
    assertEquals(tomlString, `title = "TOML Example"\n\n[owner]\nname = "Bob"\nbio = "Bob is a cool guy"\n`);