csv-stringify
Advanced tools
+17
-20
@@ -462,2 +462,17 @@ 'use strict'; | ||
| }; | ||
| // True when `value` matches one of the `quoted_match` patterns. The regexps | ||
| // come from the user and the same objects are reused for every field, so the | ||
| // test must not depend on their state: `RegExp.prototype.test` advances | ||
| // `lastIndex` on a global or sticky regexp, which would make a match in one | ||
| // field move where the next field starts matching. `String.prototype.search` | ||
| // searches from the start and restores `lastIndex`, and is equivalent to | ||
| // `test` for the stateless regexps. | ||
| const matches_quoted_match = function (value, quoted_match) { | ||
| if (!quoted_match) return false; | ||
| return quoted_match.some((pattern) => | ||
| typeof pattern === "string" | ||
| ? value.indexOf(pattern) !== -1 | ||
| : value.search(pattern) !== -1, | ||
| ); | ||
| }; | ||
@@ -624,12 +639,3 @@ const stringifier = function (options, state, info) { | ||
| if ("" === value && "" === field) { | ||
| let quotedMatch = | ||
| quoted_match && | ||
| quoted_match.filter((quoted_match) => { | ||
| if (typeof quoted_match === "string") { | ||
| return value.indexOf(quoted_match) !== -1; | ||
| } else { | ||
| return quoted_match.test(value); | ||
| } | ||
| }); | ||
| quotedMatch = quotedMatch && quotedMatch.length > 0; | ||
| const quotedMatch = matches_quoted_match(value, quoted_match); | ||
| const shouldQuote = | ||
@@ -659,12 +665,3 @@ quotedMatch || | ||
| const quotedString = quoted_string && typeof field === "string"; | ||
| let quotedMatch = | ||
| quoted_match && | ||
| quoted_match.filter((quoted_match) => { | ||
| if (typeof quoted_match === "string") { | ||
| return value.indexOf(quoted_match) !== -1; | ||
| } else { | ||
| return quoted_match.test(value); | ||
| } | ||
| }); | ||
| quotedMatch = quotedMatch && quotedMatch.length > 0; | ||
| const quotedMatch = matches_quoted_match(value, quoted_match); | ||
| // See https://github.com/adaltas/node-csv/pull/387 | ||
@@ -671,0 +668,0 @@ // More about CSV injection or formula injection, when websites embed |
+17
-20
@@ -460,2 +460,17 @@ 'use strict'; | ||
| }; | ||
| // True when `value` matches one of the `quoted_match` patterns. The regexps | ||
| // come from the user and the same objects are reused for every field, so the | ||
| // test must not depend on their state: `RegExp.prototype.test` advances | ||
| // `lastIndex` on a global or sticky regexp, which would make a match in one | ||
| // field move where the next field starts matching. `String.prototype.search` | ||
| // searches from the start and restores `lastIndex`, and is equivalent to | ||
| // `test` for the stateless regexps. | ||
| const matches_quoted_match = function (value, quoted_match) { | ||
| if (!quoted_match) return false; | ||
| return quoted_match.some((pattern) => | ||
| typeof pattern === "string" | ||
| ? value.indexOf(pattern) !== -1 | ||
| : value.search(pattern) !== -1, | ||
| ); | ||
| }; | ||
@@ -622,12 +637,3 @@ const stringifier = function (options, state, info) { | ||
| if ("" === value && "" === field) { | ||
| let quotedMatch = | ||
| quoted_match && | ||
| quoted_match.filter((quoted_match) => { | ||
| if (typeof quoted_match === "string") { | ||
| return value.indexOf(quoted_match) !== -1; | ||
| } else { | ||
| return quoted_match.test(value); | ||
| } | ||
| }); | ||
| quotedMatch = quotedMatch && quotedMatch.length > 0; | ||
| const quotedMatch = matches_quoted_match(value, quoted_match); | ||
| const shouldQuote = | ||
@@ -657,12 +663,3 @@ quotedMatch || | ||
| const quotedString = quoted_string && typeof field === "string"; | ||
| let quotedMatch = | ||
| quoted_match && | ||
| quoted_match.filter((quoted_match) => { | ||
| if (typeof quoted_match === "string") { | ||
| return value.indexOf(quoted_match) !== -1; | ||
| } else { | ||
| return quoted_match.test(value); | ||
| } | ||
| }); | ||
| quotedMatch = quotedMatch && quotedMatch.length > 0; | ||
| const quotedMatch = matches_quoted_match(value, quoted_match); | ||
| // See https://github.com/adaltas/node-csv/pull/387 | ||
@@ -669,0 +666,0 @@ // More about CSV injection or formula injection, when websites embed |
+17
-20
@@ -21,2 +21,17 @@ import { get } from "../utils/get.js"; | ||
| }; | ||
| // True when `value` matches one of the `quoted_match` patterns. The regexps | ||
| // come from the user and the same objects are reused for every field, so the | ||
| // test must not depend on their state: `RegExp.prototype.test` advances | ||
| // `lastIndex` on a global or sticky regexp, which would make a match in one | ||
| // field move where the next field starts matching. `String.prototype.search` | ||
| // searches from the start and restores `lastIndex`, and is equivalent to | ||
| // `test` for the stateless regexps. | ||
| const matches_quoted_match = function (value, quoted_match) { | ||
| if (!quoted_match) return false; | ||
| return quoted_match.some((pattern) => | ||
| typeof pattern === "string" | ||
| ? value.indexOf(pattern) !== -1 | ||
| : value.search(pattern) !== -1, | ||
| ); | ||
| }; | ||
@@ -183,12 +198,3 @@ const stringifier = function (options, state, info) { | ||
| if ("" === value && "" === field) { | ||
| let quotedMatch = | ||
| quoted_match && | ||
| quoted_match.filter((quoted_match) => { | ||
| if (typeof quoted_match === "string") { | ||
| return value.indexOf(quoted_match) !== -1; | ||
| } else { | ||
| return quoted_match.test(value); | ||
| } | ||
| }); | ||
| quotedMatch = quotedMatch && quotedMatch.length > 0; | ||
| const quotedMatch = matches_quoted_match(value, quoted_match); | ||
| const shouldQuote = | ||
@@ -218,12 +224,3 @@ quotedMatch || | ||
| const quotedString = quoted_string && typeof field === "string"; | ||
| let quotedMatch = | ||
| quoted_match && | ||
| quoted_match.filter((quoted_match) => { | ||
| if (typeof quoted_match === "string") { | ||
| return value.indexOf(quoted_match) !== -1; | ||
| } else { | ||
| return quoted_match.test(value); | ||
| } | ||
| }); | ||
| quotedMatch = quotedMatch && quotedMatch.length > 0; | ||
| const quotedMatch = matches_quoted_match(value, quoted_match); | ||
| // See https://github.com/adaltas/node-csv/pull/387 | ||
@@ -230,0 +227,0 @@ // More about CSV injection or formula injection, when websites embed |
+2
-2
| { | ||
| "version": "6.8.2", | ||
| "version": "6.8.3", | ||
| "name": "csv-stringify", | ||
@@ -110,3 +110,3 @@ "description": "CSV stringifier implementing the Node.js `stream.Transform` API", | ||
| }, | ||
| "gitHead": "288c9c6877b405c530181f6fb4967c63e0d8ffa1" | ||
| "gitHead": "3591c0770f7235b203f7cbcd7805ddedfaaf3ce1" | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
947275
0.1%25944
-0.1%