parseArray(text: string): Promise<[string | null, string[][]][]>
Parse an INI string into an array of sections.
Since it returns an array, it supports duplicate keys and sections. This is the reverse of stringifyArray.
Each section is represented by a tuple of [sectionName, entries] where
sectionName is null for the global section, and entries is an array
of [key, value] pairs. Order of sections and entries is preserved.
Parse INI with global and named sections
Parse INI with global and named sections
import { parseArray } from "@hertzg/wg-ini"; import { assertEquals } from "@std/assert"; const text = [ "global_key=global_value", "", "[mysection]", "key1=1", "key2=2", "", ].join("\n"); assertEquals(await parseArray(text), [ [null, [["global_key", "global_value"]]], ["mysection", [["key1", "1"], ["key2", "2"]]], ]);