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.1.0 to 1.2.0

.npmignore

30

ini.js

@@ -45,8 +45,8 @@

function dotSplit (str) {
return str.replace(/\1/g, '\2LITERAL\\1LITERAL\2')
.replace(/\\\./g, '\1')
return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
.replace(/\\\./g, '\u0001')
.split(/\./).map(function (part) {
return part.replace(/\1/g, '\\.')
.replace(/\2LITERAL\\1LITERAL\2/g, '\1')
})
.replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
})
}

@@ -65,3 +65,3 @@

lines.forEach(function (line, _, __) {
if (!line || line.match(/^\s*;/)) return
if (!line || line.match(/^\s*[;#]/)) return
var match = line.match(re)

@@ -127,2 +127,7 @@ if (!match) return

function isQuoted (val) {
return (val.charAt(0) === "\"" && val.slice(-1) === "\"")
|| (val.charAt(0) === "'" && val.slice(-1) === "'")
}
function safe (val) {

@@ -133,7 +138,6 @@ return ( typeof val !== "string"

|| (val.length > 1
&& val.charAt(0) === "\""
&& val.slice(-1) === "\"")
&& isQuoted(val))
|| val !== val.trim() )
? JSON.stringify(val)
: val.replace(/;/g, '\\;')
: val.replace(/;/g, '\\;').replace(/#/g, "\\#")
}

@@ -143,3 +147,7 @@

val = (val || "").trim()
if (val.charAt(0) === "\"" && val.slice(-1) === "\"") {
if (isQuoted(val)) {
// remove the single quotes before calling JSON.parse
if (val.charAt(0) === "'") {
val = val.substr(1, val.length - 2);
}
try { val = JSON.parse(val) } catch (_) {}

@@ -153,3 +161,3 @@ } else {

if (esc) {
if (c === "\\" || c === ";")
if ("\\;#".indexOf(c) !== -1)
unesc += c

@@ -159,3 +167,3 @@ else

esc = false
} else if (c === ";") {
} else if (";#".indexOf(c) !== -1) {
break

@@ -162,0 +170,0 @@ } else if (c === "\\") {

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

"description": "An ini encoder/decoder for node",
"version": "1.1.0",
"version": "1.2.0",
"repository": {

@@ -20,4 +20,4 @@ "type": "git",

"devDependencies": {
"tap": "~0.0.9"
"tap": "~0.4.0"
}
}

@@ -13,2 +13,5 @@ var i = require("../")

+ '"[disturbing]" = hey you never know\n'
+ 's = something\n'
+ 's1 = \"something\'\n'
+ 's2 = something else\n'
+ 'zr[] = deedee\n'

@@ -32,2 +35,3 @@ + 'ar[] = one\n'

+ 'nocomment = this\\; this is not a comment\n'
+ 'noHashComment = this\\# this is not a comment\n'
, expectD =

@@ -38,2 +42,5 @@ { o: 'p',

'[disturbing]': 'hey you never know',
's': 'something',
's1' : '\"something\'',
's2': 'something else',
'zr': ['deedee'],

@@ -53,3 +60,4 @@ 'ar': ['one', 'three', 'this is included'],

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

@@ -56,0 +64,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