Module

std/ini/mod.ts>IniMap

The Deno Standard Library
Latest
class IniMap
import { IniMap } from "https://dotland.deno.dev/std@0.224.0/ini/mod.ts";

Class implementation for fine control of INI data structures.

Constructors

new
IniMap(formatting?: FormattingOptions)

Properties

readonly
comments: Comments

Manage comments in the INI.

readonly
formatting: Formatting
readonly
size: number

Get the count of key/value pairs.

Methods

clear(sectionName?: string): void

Clear a single section or the entire INI.

delete(key: string): boolean

Delete a global key in the INI.

delete(section: string, key: string): boolean

Delete a section key in the INI.

entries(): Generator<[string, unknown, string | undefined]>

Iterate over each entry in the INI to retrieve key, value, and section.

get(key: string): unknown

Get a value from a global key in the INI.

get(section: string, key: string): unknown

Get a value from a section key in the INI.

has(key: string): boolean

Check if a global key exists in the INI.

has(section: string, key: string): boolean

Check if a section key exists in the INI.

parse(text: string, reviver?: ReviverFunction): this

Parse an INI string in this IniMap.

set(key: string, value: any): this

Set the value of a global key in the INI.

set(
section: string,
key: string,
value: any,
): this

Set the value of a section key in the INI.

toJSON(): Record<string, unknown | Record<string, unknown>>

Convenience method for JSON.stringify.

toObject(): Record<string, unknown | Record<string, unknown>>

Convert this IniMap to a plain object.

toString(replacer?: ReplacerFunction): string

Convert this IniMap to an INI string.

Static Methods

from(input: string, options?: ParseOptions & FormattingOptions): IniMap

Create an IniMap from an INI string.

from(input: Record<string, any>, formatting?: FormattingOptions): IniMap

Create an IniMap from a plain object.

import IniMap
import { IniMap } from "https://dotland.deno.dev/std@0.224.0/ini/mod.ts";