import('data-ini') provides INI file parsing and serialization supporting sections, key-value pairs, comments (# and ;), and quoted values.
ini := import('data-ini')
// Parse INI text
config := ini.parse('
[database]
host = localhost
port = 5432
debug = true
[app]
name = "My App"
')
// config.database.host => 'localhost'
// config.database.port => 5432
// config.app.name => 'My App'
// Serialize to INI
text := ini.serialize({
database: { host: 'localhost', port: 5432 }
app: { name: 'My App' }
})
Parses INI text into an Oak object. Sections become nested objects. Supports:
[section]headerskey = valuepairs- Comments: lines starting with
#or; - Quoted values with
"or' - Automatic type coercion: booleans, integers, floats, atoms, null
Converts an Oak object to INI format. Global (non-object) properties are written first, followed by [section] blocks.
- Values are automatically typed on parse:
true/false→ booleans, numeric strings → numbers. - Empty values and
nullare supported. - Nested sections (sub-sections) are not supported — only one level of
[section]grouping.