@nodecraft/ini
Advanced tools
Comparing version 1.4.0 to 2.0.0
@@ -76,2 +76,4 @@ 'use strict'; | ||
function decode(str, opt = {}){ | ||
const defaultValue = typeof opt.defaultValue !== 'undefined' ? opt.defaultValue : ''; | ||
const out = {}; | ||
@@ -94,3 +96,3 @@ let ref = out; | ||
let key = unsafe(match[2]); | ||
let value = match[3] ? unsafe(match[3]) : true; | ||
let value = match[3] ? unsafe(match[3]) : defaultValue; | ||
switch(value){ | ||
@@ -97,0 +99,0 @@ case 'true': |
{ | ||
"name": "@nodecraft/ini", | ||
"version": "1.4.0", | ||
"version": "2.0.0", | ||
"description": "An ini encoder/decoder for node", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -26,2 +26,10 @@ An ini format parser and serializer for node. | ||
### New `defaultValue` option | ||
An `defaultValue` option when decoding to use when encountering a key without a value. | ||
```ini | ||
key= | ||
secondkey | ||
``` | ||
Previously both keys would contain the value `true`, now both keys would contain whatever this option is set to, or an empty string if this option is not set. This is a breaking change, and will decode some inputs differently. | ||
## Usage | ||
@@ -28,0 +36,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11676
192
138