dot-properties
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -81,2 +81,3 @@ export class Node { | ||
pathSep?: '.' | string // if non-default, use the same in parse() | ||
foldChars?: '\f\t .' | string | ||
} | ||
@@ -83,0 +84,0 @@ |
@@ -22,3 +22,3 @@ const { Pair, Comment, EmptyLine } = require('./ast') | ||
function fold({ indent, latin1, lineWidth, newline }, key, value) { | ||
function fold({ indent, latin1, lineWidth, newline, foldChars }, key, value) { | ||
const printKey = escapeNonPrintable(key, latin1) | ||
@@ -56,14 +56,16 @@ const printValue = escapeNonPrintable(value, latin1) | ||
case ' ': | ||
case '=': | ||
case ':': | ||
if (foldChars.includes(line[i])) split = i + 1 | ||
break | ||
case 'f': | ||
if (foldChars.includes('\f')) split = i + 1 | ||
break | ||
case 't': | ||
split = i + 1 | ||
if (foldChars.includes('\t')) split = i + 1 | ||
break | ||
} | ||
break | ||
case '\f': | ||
case '\t': | ||
case ' ': | ||
case '.': | ||
split = i + 1 | ||
break | ||
default: | ||
if (foldChars.includes(ch)) split = i + 1 | ||
} | ||
@@ -119,3 +121,4 @@ } | ||
newline = '\n', | ||
pathSep = '.' | ||
pathSep = '.', | ||
foldChars = '\f\t .' | ||
} = {} | ||
@@ -125,4 +128,16 @@ ) { | ||
if (!Array.isArray(input)) input = toLines(input, pathSep, defaultKey) | ||
const lineOpt = { indent, latin1, lineWidth, newline: '\\' + newline } | ||
const commentOpt = { indent: commentPrefix, latin1, lineWidth, newline } | ||
const lineOpt = { | ||
indent, | ||
latin1, | ||
lineWidth, | ||
newline: '\\' + newline, | ||
foldChars | ||
} | ||
const commentOpt = { | ||
indent: commentPrefix, | ||
latin1, | ||
lineWidth, | ||
newline, | ||
foldChars | ||
} | ||
return input | ||
@@ -129,0 +144,0 @@ .map(line => { |
{ | ||
"name": "dot-properties", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Eemeli Aro <eemeli@gmail.com>", |
@@ -49,3 +49,4 @@ # dot-properties | ||
newline: '\n', // Windows uses \r\n | ||
pathSep: '.' // if non-default, use the same in parse() | ||
pathSep: '.', // if non-default, use the same in parse() | ||
foldChars: '\f\t .' // preferred characters for line folding | ||
} | ||
@@ -52,0 +53,0 @@ ``` |
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
22108
493
149