{"id":13339,"library":"ini-simple-parser","title":"INI Simple Parser","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/fabiospampinato/ini-simple-parser","tags":["javascript","ini","simple","parser","editorconfig","typescript"],"install":[{"cmd":"npm install ini-simple-parser","lang":"bash","label":"npm"},{"cmd":"yarn add ini-simple-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add ini-simple-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library primarily exposes a default export for the parser function. CommonJS `require` will return `{ default: parse }`.","wrong":"const parse = require('ini-simple-parser');","symbol":"parse","correct":"import parse from 'ini-simple-parser';"},{"note":"Type import for the configuration object. The library ships with TypeScript types.","symbol":"Options","correct":"import type { Options } from 'ini-simple-parser';"}],"quickstart":{"code":"import parse from 'ini-simple-parser';\n\nconst INPUT = `\n  root=true\n  notRoot=\"false\"\n\n  [owner]\n  name=John Doe\n\n  [database]\n  server = 192.0.2.62\n  port = 143\n  file = \"payroll.dat\"\n  extra1 = something ; Inline comment\n  extra2 = something else # Inline comment\n  null = null\n  nil = \"0\"\n`;\n\n// Parse with all inference options enabled to demonstrate type conversion and comment stripping\nconst parsed = parse ( INPUT, {\n  inferBooleans: true,\n  inferNulls: true,\n  inferNumbers: true,\n  inferStrings: true,\n  inlineComments: true\n});\n\nconsole.log(parsed);\n/* Expected output:\n{\n  root: true,\n  notRoot: 'false',\n  owner: {\n    name: 'John Doe'\n  },\n  database: {\n    server: '192.0.2.62',\n    port: 143,\n    file: 'payroll.dat',\n    extra1: 'something',\n    extra2: 'something else',\n    null: null,\n    nil: '0'\n  }\n}\n*/","lang":"typescript","description":"Demonstrates parsing a complex INI string with all available inference options enabled, showing automatic type conversion and comment stripping."},"warnings":[{"fix":"Pass an options object to the `parse` function, e.g., `parse(input, { inferBooleans: true, inferNumbers: true, inferStrings: true })`.","message":"By default, the parser treats all values as strings. Type inference (for booleans, nulls, numbers) and string unquoting must be explicitly enabled via options.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"To remove inline comments, use `parse(input, { inlineComments: true })`.","message":"Inline comments, both starting with `;` and `#`, are preserved in the parsed string values unless the `inlineComments` option is set to `true`.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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';`.","cause":"Attempting to `require` the package in a CommonJS environment and directly assigning the result, while the package uses a default export pattern.","error":"TypeError: parse is not a function"},{"fix":"Enable specific inference options when calling `parse`. For example, `parse(input, { inferBooleans: true, inferNulls: true, inferNumbers: true })`.","cause":"The parser's type inference options are not enabled by default for strict string parsing.","error":"My numbers/booleans/nulls are strings, not native types."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null}