INI Simple Parser
A simple, fast and configurable INI parser.
Install
npm install --save ini-simple-parser
Usage
The following options are supported:
type Options = {
inferBooleans?: boolean,
inferNulls?: boolean,
inferNumbers?: boolean,
inferStrings?: boolean,
inlineComments?: boolean
};
This is how you'd use it:
import parse from 'ini-simple-parser';
const INPUT = `
root=true
notRoot="false"
; last modified 1 April 2001 by John Doe
[owner]
name=John Doe
organization=Acme Widgets Inc.
[database]
# use IP address in case network name resolution is not working
server = 192.0.2.62
port = 143
file = "payroll.dat"
extra1 = something ; Inline comment
extra2 = something else # Inline comment
null = null
nil = "0"
`;
const parsed = parse ( INPUT );
const parsed = parse ( INPUT, {
inferBooleans: true,
inferNulls: true,
inferNumbers: true,
inferStrings: true,
inlineComments: true
});
License
MIT © Fabio Spampinato