function stringifyObject
stringifyObject(obj: Record<string, Record<string, unknown>>): Promise<string>

Convert an object to an INI string.

Since it takes an object, it does not support duplicate keys or sections. This is the reverse of parseObject and uses stringifyArray under the hood.

Global properties (entries before any section header) should be stored under the empty string key "".

Examples

Stringify object to INI

import { stringifyObject } from "@hertzg/wg-ini";
import { assertEquals } from "@std/assert";

const obj = {
  "": { global_key: "global_value" },
  mysection: { key1: "1", key2: "2" },
};

assertEquals(await stringifyObject(obj), [
  "global_key=global_value",
  "",
  "[mysection]",
  "key1=1",
  "key2=2",
  "",
].join("\n"));

Parameters

obj: Record<string, Record<string, unknown>>

The object to convert to an INI string.

Return Type

Promise<string>

A promise resolving to the INI content as a string.

Usage

import { stringifyObject } from "mod.ts";