From 585b427bba9868e12e201ebb02f4c452649dce0f Mon Sep 17 00:00:00 2001 From: jaymeans Date: Fri, 27 Jul 2018 16:30:46 -0700 Subject: [PATCH] changed 'strict' to 'greedy' --- docs/docs.html | 2 +- papaparse.js | 2 +- tests/test-cases.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs.html b/docs/docs.html index 67c5b0b..b7ef9e0 100644 --- a/docs/docs.html +++ b/docs/docs.html @@ -505,7 +505,7 @@ var csv = Papa.unparse({ skipEmptyLines - If true, lines that are completely empty (those which evaluate to an empty string) will be skipped. If set to 'strict', lines that don't have any content (those which have only delimiters, quotes, and whitespace) will also be skipped. + If true, lines that are completely empty (those which evaluate to an empty string) will be skipped. If set to 'greedy', lines that don't have any content (those which have only delimiters, quotes, and whitespace) will also be skipped. diff --git a/papaparse.js b/papaparse.js index b1bce05..c7e4bbc 100755 --- a/papaparse.js +++ b/papaparse.js @@ -1077,7 +1077,7 @@ function testEmptyLine(s, d) { var q = _config.quoteChar || '"'; - var r = _config.skipEmptyLines === 'strict' ? new RegExp('^[' + escapeRegExp(d) + escapeRegExp(q) + '\\s]*$') : new RegExp('^$'); + var r = _config.skipEmptyLines === 'greedy' ? new RegExp('^[' + escapeRegExp(d) + escapeRegExp(q) + '\\s]*$') : new RegExp('^$'); for (var i = 0; i < s.length; i++) if (r.test(s[i])) return true; diff --git a/tests/test-cases.js b/tests/test-cases.js index 74e2ea8..ef7d0a5 100644 --- a/tests/test-cases.js +++ b/tests/test-cases.js @@ -1340,10 +1340,10 @@ var PARSE_TESTS = [ } }, { - description: "Parsing with skipEmptyLines set to 'strict'", + description: "Parsing with skipEmptyLines set to 'greedy'", notes: "Must parse correctly without lines with no content", input: 'a,b\n\n,\nc,d\n , \n""," "\n " " , " "\n,,,,\n",,,",","\n', - config: { skipEmptyLines: 'strict' }, + config: { skipEmptyLines: 'greedy' }, expected: { data: [['a', 'b'], ['c', 'd']], errors: [] @@ -1353,7 +1353,7 @@ var PARSE_TESTS = [ description: "Parsing with skipNoContentLines and regex special char as quoteChar", notes: "Must skip lines correctly with reserved regex char as quoteChar", input: 'a,b\n\n,\nc,d\n , \n]],] ]\n ] ] , ] ]\n,,,,\n],,,],],]\n', - config: { skipEmptyLines: 'strict', quoteChar: ']' }, + config: { skipEmptyLines: 'greedy', quoteChar: ']' }, expected: { data: [['a', 'b'], ['c', 'd']], errors: [] @@ -1363,7 +1363,7 @@ var PARSE_TESTS = [ description: "Parsing with skipNoContentLines and regex special char as delimiter", notes: "Must skip lines correctly with reserved regex char as delimiter", input: 'a]b\n\n]\nc]d\n ] \n""]" "\n " " ] " "\n]]]]\n"]]]"]"]"\n', - config: { skipEmptyLines: 'strict', delimiter: ']' }, + config: { skipEmptyLines: 'greedy', delimiter: ']' }, expected: { data: [['a', 'b'], ['c', 'd']], errors: []