Skip to main content

@std/ini@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score76%
Published2 years ago (0.215.0)

Classes

c
IniMap(formatting?: FormattingOptions)

Class implementation for fine control of INI data structures.

  • clear(sectionName?: string): void

    Clear a single section or the entire INI.

  • comments(): Comments

    Manage comments in the INI.

  • delete(key: string): boolean

    Delete a global key in the INI.

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

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

  • formatting(): Formatting
    No documentation available
  • from(
    input: string,
    options?: ParseOptions & FormattingOptions
    ): IniMap

    Create an IniMap from an INI string.

  • get(key: string): unknown

    Get a value from a global key in the INI.

  • has(key: string): boolean

    Check if a global 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.

  • size(): number

    Get the count of key/value pairs.

  • 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.

Interfaces

I
No documentation available
  • clear(): void

    Clear all comments in the INI.

  • deleteAtKey(key: string): boolean

    Delete a comment before a global key in the INI.

  • deleteAtLine(line: number): boolean

    Delete a comment at a specific line in the INI.

  • deleteAtSection(section: string): boolean

    Delete a comment before a section line in the INI.

  • getAtKey(key: string): string | undefined

    Get a comment before a global key in the INI.

  • getAtLine(line: number): string | undefined

    Get a comment at a specific line in the INI.

  • getAtSection(section: string): string | undefined

    Get a comment before a section line in the INI.

  • setAtKey(
    key: string,
    text: string
    ): Comments

    Set a comment before a global key in the INI.

  • setAtLine(
    line: number,
    text: string
    ): Comments

    Set a comment at a specific line in the INI.

  • setAtSection(
    section: string,
    text: string
    ): Comments

    Set a comment before a section line in the INI.

I

Options for providing formatting marks.

  • assignment: string

    The character used to assign a value to a key; defaults to '='.

  • commentChar: "#" | ";" | "//"

    Mark to use for setting comments; expects '#', ';', '//', defaults to '#' unless another mark is found.

  • deduplicate: boolean

    Filter duplicate keys from INI string output; defaults to false to preserve data parity.

  • lineBreak: "\n" | "\r\n"

    Character(s) used to break lines in the config file; defaults to '\n'. Ignored on parse.

  • pretty: boolean

    Use a plain assignment char or pad with spaces; defaults to false. Ignored on parse.

I

Options for parsing INI strings.

  • assignment: FormattingOptions["assignment"]

    The character used to assign a value to a key; defaults to '='.

  • reviver: ReviverFunction

    Provide custom parsing of the value in a key/value pair.

I

Options for constructing INI strings.

  • replacer: ReplacerFunction

    Provide custom string conversion for the value in a key/value pair.

Type Aliases

T
ReplacerFunction = (
key: string,
value: any,
section?: string
) => string

Function for replacing JavaScript values with INI string values.

T
ReviverFunction = (
key: string,
value: any,
section?: string
) => any

Function for replacing INI values with JavaScript values.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/ini

Import symbol

import * as mod from "@std/ini/ini_map";
or

Import directly with a jsr specifier

import * as mod from "jsr:@std/ini/ini_map";