npm / ini

An ini parser/serializer in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quotes are not stripped from escaped property values when inline comments are present

lpd-au opened this issue · comments

Ini property values may be quoted to escape special characters and indicate they are strings. However, comments following a quoted property value force the quotes to appear literally in the output.

Test Case

const ini = require('ini');

console.log(ini.decode('a.b = "c"'));
console.log(ini.decode('a.b = "c" ; asdf'));
console.log(ini.decode('a.b = c ; asdf'));

Expected Output

{ 'a.b': 'c' }
{ 'a.b': 'c' }
{ 'a.b': 'c' }
=> undefined

Actual Output

{ 'a.b': 'c' }
{ 'a.b': '"c"' }
{ 'a.b': 'c' }
=> undefined

This issue relates to: #81.