Registry / serialization / ini-simple-parser

ini-simple-parser

JSON →
library1.0.1jsnpmunverified

ini-simple-parser is a lightweight, performant, and configurable library designed for parsing INI (initialization file) format strings in JavaScript and TypeScript environments. It is currently at version 1.0.1, indicating a stable initial release. The library focuses on simplicity and speed, offering options to infer data types such as booleans, nulls, and numbers, as well as automatic removal of wrapping quotes and inline comments. This differentiates it by providing a clean, configurable API for common INI parsing needs without excessive complexity, making it suitable for applications requiring straightforward configuration file handling. Its release cadence is not explicitly stated but typically for such a utility, updates would address bugs or minor feature enhancements rather than frequent major overhauls.

npm install ini-simple-parser
INSTALL
IMPORT
SIG · INI-SIMPLE-PARSER
I
ini-simple-parser
serializationjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
import parse from 'ini-simple-parser';
const parse = require('ini-simple-parser');
The library primarily exposes a default export for the parser function. CommonJS `require` will return `{ default: parse }`.
Options
import type { Options } from 'ini-simple-parser';
Type import for the configuration object. The library ships with TypeScript types.

Demonstrates parsing a complex INI string with all available inference options enabled, showing automatic type conversion and comment stripping.

import parse from 'ini-simple-parser'; const INPUT = ` root=true notRoot="false" [owner] name=John Doe [database] server = 192.0.2.62 port = 143 file = "payroll.dat" extra1 = something ; Inline comment extra2 = something else # Inline comment null = null nil = "0" `; // Parse with all inference options enabled to demonstrate type conversion and comment stripping const parsed = parse ( INPUT, { inferBooleans: true, inferNulls: true, inferNumbers: true, inferStrings: true, inlineComments: true }); console.log(parsed); /* Expected output: { root: true, notRoot: 'false', owner: { name: 'John Doe' }, database: { server: '192.0.2.62', port: 143, file: 'payroll.dat', extra1: 'something', extra2: 'something else', null: null, nil: '0' } } */
Debug
Known issues
gotchaBy default, the parser treats all values as strings. Type inference (for booleans, nulls, numbers) and string unquoting must be explicitly enabled via options.
fix
Pass an options object to the `parse` function, e.g., `parse(input, { inferBooleans: true, inferNumbers: true, inferStrings: true })`.
affects: >=1.0.0
gotchaInline comments, both starting with `;` and `#`, are preserved in the parsed string values unless the `inlineComments` option is set to `true`.
fix
To remove inline comments, use `parse(input, { inlineComments: true })`.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: parse is not a function
Attempting to `require` the package in a CommonJS environment and directly assigning the result, while the package uses a default export pattern.
fix
For CommonJS, access the default export: `const parse = require('ini-simple-parser').default;` or migrate to ESM imports: `import parse from 'ini-simple-parser';`.
My numbers/booleans/nulls are strings, not native types.
The parser's type inference options are not enabled by default for strict string parsing.
fix
Enable specific inference options when calling `parse`. For example, `parse(input, { inferBooleans: true, inferNulls: true, inferNumbers: true })`.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
ini-simple-parser — npm install ini-simple-parser · libregistry