UNPKG

keep-a-changelog

Version:

Node package to parse and generate changelogs following the [keepachangelog](https://keepachangelog.com/) format.

56 lines 1.37 kB
import { type ParseOptions } from "./ini_map.js"; /** * Parse an INI config string into an object. Provide formatting options to override the default assignment operator. * * @example Usage * ```ts * import { parse } from "@std/ini/parse"; * import { assertEquals } from "@std/assert"; * * const parsed = parse(` * key = value * * [section 1] * foo = Hello * baz = World * `); * * assertEquals(parsed, { key: "value", "section 1": { foo: "Hello", baz: "World" } }) * ``` * * @example Using custom reviver * ```ts * import { parse } from "@std/ini/parse"; * import { assertEquals } from "@std/assert"; * * const parsed = parse(` * [section Foo] * date = 2012-10-10 * amount = 12345 * `, { * reviver(key, value, section) { * if (section === "section Foo") { * if (key === "date") { * return new Date(value); * } else if (key === "amount") { * return +value; * } * } * return value; * } * }); * * assertEquals(parsed, { * "section Foo": { * date: new Date("2012-10-10"), * amount: 12345, * } * }) * ``` * * @param text The text to parse * @param options The options to use * @return The parsed object */ export declare function parse(text: string, options?: ParseOptions): Record<string, unknown | Record<string, unknown>>; //# sourceMappingURL=parse.d.ts.map