npm / ini

An ini parser/serializer in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Single quotes removed from values

simoneb opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Decoding then encoding (without further transformation) a file like this:

ActiveIndex = '0'
MaximizedFlag = '1911'
ProductVersion = '14.0.25793.400'
Version = '1'
WindowCount = '1'

Turns it into this:

ActiveIndex=0
MaximizedFlag=1911
ProductVersion=14.0.25793.400
Version=1
WindowCount=1

It basically removed the single quotes around the values, thereby causing a compatibility issue with the software that is supposed to open this file.

Expected Behavior

Single quotes are not removed from values

Steps To Reproduce

import fs from "fs";
import ini from "ini";

const input = `ActiveIndex = '0'
MaximizedFlag = '1911'
ProductVersion = '14.0.25793.400'
Version = '1'
WindowCount = '1'`

const data = ini.parse(input);

// prints the values without quotes
console.log(ini.stringify(data));

Environment

  • npm: 10.2.4
  • Node: 21.5.0
  • OS: Windows 11
  • platform: -