Skip to main content

@std/toml@1.0.2
Built and signed on GitHub Actions

Parsing and serializing of TOML files

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a day ago (1.0.2)
function stringify
stringify(
obj: Record<string, unknown>,
options?: StringifyOptions,
): string

Converts an object to a TOML string.

Examples

Usage

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`);

Parameters

obj: Record<string, unknown>

Source object

optional
options: StringifyOptions

Options for stringifying.

Return Type

TOML string

Add Package

deno add jsr:@std/toml

Import symbol

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

---- OR ----

Import directly with a jsr specifier

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

Add Package

npx jsr add @std/toml

Import symbol

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

Add Package

yarn dlx jsr add @std/toml

Import symbol

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

Add Package

pnpm dlx jsr add @std/toml

Import symbol

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

Add Package

bunx jsr add @std/toml

Import symbol

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