node-iniparser icon indicating copy to clipboard operation
node-iniparser copied to clipboard

Space as null value flag

Open Mejari opened this issue 12 years ago • 0 comments

I needed slightly different behavior so I thought I would option-ize it. I've set up an additional "options" object parameter on the 3 parse methods (with backwards compatibility for iniparser.parse callback). Also updated readme and added test for the single new option: treatEmptyStringsAsNull, which will, as the name suggests, set the value of parameters that have no direct value (which come in as an empty string) to null.

For example:

var_with_noValue=

Would come in when the flag is false (default) as:

{
     var_withNoValue: ''
}

and the same thing would come in when the flag is true as:

{
     var_withNoValue: null
}

It should be relatively easy to add new parameters in the future.

Mejari avatar May 15 '13 19:05 Mejari