stringify

import { stringify } from "jsr:@ende/toml";

function

function stringify(obj: Record<string, unknown>, options?: StringifyOptions): string

Converts an object to a TOML string.

obj: Record<string, unknown>

Source object

options?: StringifyOptions

Options for stringifying.

Returns

TOML string

Example: Usage

import { stringify } from "@ende/toml/stringify";
import { assertEquals } from "@ende/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`);

Source