parse-ini-string
Advanced tools
Comparing version 0.0.0 to 0.0.1
@@ -10,2 +10,3 @@ 'use strict'; | ||
var trimReg = /(^\s+)|\s+$/g; | ||
var stripQuoteReg = /\\"/g; | ||
var isArray = Array.isArray; | ||
@@ -25,2 +26,3 @@ | ||
var stripQuote = function stripQuote(s) { | ||
s = s.replace(stripQuoteReg, '"'); | ||
return s.substring(1, s.length - 1); | ||
@@ -54,3 +56,3 @@ }; | ||
key = match[2]; | ||
value = value = match[3] ? match[4] || '' : ''; | ||
value = match[3] ? match[4] || '' : ''; | ||
if (key.length > 2 && key.slice(-2) === '[]') { | ||
@@ -67,8 +69,2 @@ key = key.substring(0, key.length - 2); | ||
} | ||
switch (value) { | ||
case 'true': | ||
case 'false': | ||
case 'null': | ||
value = JSON.parse(value); | ||
} | ||
} else { | ||
@@ -81,5 +77,11 @@ if (trim(line).slice(-1) === '"') { | ||
if (isEnd) { | ||
if (value.length && isQuoted(value)) { | ||
if (isQuoted(value)) { | ||
value = stripQuote(value); | ||
} | ||
switch (value) { | ||
case 'true': | ||
case 'false': | ||
case 'null': | ||
value = JSON.parse(value); | ||
} | ||
if (isArray(p[key])) { | ||
@@ -86,0 +88,0 @@ p[key].push(value); |
{ | ||
"name": "parse-ini-string", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "PHP like parse-ini-string, support multi line", | ||
@@ -5,0 +5,0 @@ "repository": "react-atomic/react-atomic-organism", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3449
87