Socket
Socket
Sign inDemoInstall

ini

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ini - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

34

ini.js

@@ -59,6 +59,3 @@

lines.forEach(function (line, _, __) {
//line = line
var rem = line.indexOf(";")
if (rem !== -1) line = line.substr(0, rem)//.trim()
if (!line) return
if (!line || line.match(/^\s*;/)) return
var match = line.match(re)

@@ -112,11 +109,36 @@ if (!match) return

&& val.slice(-1) === "\"")
|| val !== val.trim() ) ? JSON.stringify(val) : val
|| val !== val.trim() )
? JSON.stringify(val)
: val.replace(/;/g, '\\;')
}
function unsafe (val) {
function unsafe (val, doUnesc) {
val = (val || "").trim()
if (val.charAt(0) === "\"" && val.slice(-1) === "\"") {
try { val = JSON.parse(val) } catch (_) {}
} else {
// walk the val to find the first not-escaped ; character
var esc = false
var unesc = "";
for (var i = 0, l = val.length; i < l; i++) {
var c = val.charAt(i)
if (esc) {
if (c === "\\" || c === ";")
unesc += c
else
unesc += "\\" + c
esc = false
} else if (c === ";") {
break
} else if (c === "\\") {
esc = true
} else {
unesc += c
}
}
if (esc)
unesc += "\\"
return unesc
}
return val
}

2

package.json

@@ -5,3 +5,3 @@ {

"description": "An ini encoder/decoder for node",
"version": "1.0.4",
"version": "1.0.5",
"repository": {

@@ -8,0 +8,0 @@ "type": "git",

@@ -24,2 +24,3 @@ var i = require("../")

+ 'a.b.c = abc\n'
+ 'nocomment = this\\; this is not a comment\n'
, expectD =

@@ -39,3 +40,4 @@ { o: 'p',

'a.b.c': {
'a.b.c': 'abc'
'a.b.c': 'abc',
'nocomment': 'this\; this is not a comment'
}

@@ -42,0 +44,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc