csv-parse
Advanced tools
Comparing version 4.4.3 to 4.4.4
@@ -10,2 +10,9 @@ | ||
## Version 4.4.4 | ||
* package: latest dependencies | ||
* bom: detection when buffer smaller than bom | ||
* package: remove deprecated @types/should dependency | ||
* package: update file path | ||
## Version 4.4.3 | ||
@@ -12,0 +19,0 @@ |
@@ -21,4 +21,6 @@ "use strict"; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -73,3 +75,3 @@ | ||
readableObjectMode: true | ||
}, opts))); | ||
}, {}, opts))); | ||
var options = {}; // Merge with user options | ||
@@ -401,2 +403,3 @@ | ||
_this.state = { | ||
bomSkipped: false, | ||
castField: fnCastField, | ||
@@ -478,2 +481,3 @@ commenting: false, | ||
var _this$state = this.state, | ||
bomSkipped = _this$state.bomSkipped, | ||
previousBuf = _this$state.previousBuf, | ||
@@ -491,8 +495,3 @@ rawBuffer = _this$state.rawBuffer, | ||
} else { | ||
// Handle UTF BOM | ||
if (bom === true && bom_utf8.compare(nextBuf, 0, 3) === 0) { | ||
buf = nextBuf.slice(3); | ||
} else { | ||
buf = nextBuf; | ||
} | ||
buf = nextBuf; | ||
} | ||
@@ -503,2 +502,24 @@ } else if (previousBuf !== undefined && nextBuf === undefined) { | ||
buf = Buffer.concat([previousBuf, nextBuf]); | ||
} // Handle UTF BOM | ||
if (bomSkipped === false) { | ||
if (bom === false) { | ||
this.state.bomSkipped = true; | ||
} else if (buf.length < 3) { | ||
// No enough data | ||
if (end === false) { | ||
// Wait for more data | ||
this.state.previousBuf = buf; | ||
return; | ||
} // skip BOM detect because data length < 3 | ||
} else { | ||
if (bom_utf8.compare(buf, 0, 3) === 0) { | ||
// Skip BOM | ||
buf = buf.slice(3); | ||
} | ||
this.state.bomSkipped = true; | ||
} | ||
} | ||
@@ -505,0 +526,0 @@ |
@@ -313,2 +313,3 @@ | ||
this.state = { | ||
bomSkipped: false, | ||
castField: fnCastField, | ||
@@ -359,3 +360,3 @@ commenting: false, | ||
let {record_delimiter} = this.options | ||
const {previousBuf, rawBuffer, escapeIsQuote, trimChars} = this.state | ||
const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote, trimChars} = this.state | ||
let buf | ||
@@ -368,8 +369,3 @@ if(previousBuf === undefined){ | ||
}else{ | ||
// Handle UTF BOM | ||
if(bom === true && bom_utf8.compare(nextBuf, 0, 3) === 0){ | ||
buf = nextBuf.slice(3) | ||
}else{ | ||
buf = nextBuf | ||
} | ||
buf = nextBuf | ||
} | ||
@@ -381,2 +377,22 @@ }else if(previousBuf !== undefined && nextBuf === undefined){ | ||
} | ||
// Handle UTF BOM | ||
if(bomSkipped === false){ | ||
if(bom === false){ | ||
this.state.bomSkipped = true | ||
}else if(buf.length < 3){ | ||
// No enough data | ||
if(end === false){ | ||
// Wait for more data | ||
this.state.previousBuf = buf | ||
return | ||
} | ||
// skip BOM detect because data length < 3 | ||
}else{ | ||
if(bom_utf8.compare(buf, 0, 3) === 0){ | ||
// Skip BOM | ||
buf = buf.slice(3) | ||
} | ||
this.state.bomSkipped = true | ||
} | ||
} | ||
const bufLen = buf.length | ||
@@ -536,3 +552,3 @@ let pos | ||
} | ||
const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr) | ||
@@ -771,3 +787,3 @@ // rtrim in non quoting is handle in __onField | ||
// Skip if the remaining buffer smaller than comment | ||
comment ? comment.length : 0, | ||
comment ? comment.length : 0, | ||
// Skip if the remaining buffer smaller than row delimiter | ||
@@ -774,0 +790,0 @@ recordDelimiterMaxLength, |
{ | ||
"version": "4.4.3", | ||
"version": "4.4.4", | ||
"name": "csv-parse", | ||
@@ -51,20 +51,19 @@ "description": "CSV parsing implementing the Node.js `stream.Transform` API", | ||
"devDependencies": { | ||
"@babel/cli": "^7.4.3", | ||
"@babel/core": "^7.4.3", | ||
"@babel/preset-env": "^7.4.3", | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^11.13.0", | ||
"@types/should": "^13.0.0", | ||
"coffeescript": "^2.4.0", | ||
"csv-generate": "^3.2.0", | ||
"@babel/cli": "^7.5.5", | ||
"@babel/core": "^7.5.5", | ||
"@babel/preset-env": "^7.5.5", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.6.9", | ||
"coffeescript": "^2.4.1", | ||
"csv-generate": "^3.2.3", | ||
"csv-spectrum": "^1.0.0", | ||
"each": "^1.2.1", | ||
"mocha": "^6.0.2", | ||
"mocha": "^6.2.0", | ||
"should": "^13.2.3", | ||
"stream-transform": "^1.0.8", | ||
"ts-node": "^8.0.3", | ||
"typescript": "^3.4.2" | ||
"stream-transform": "^2.0.1", | ||
"ts-node": "^8.3.0", | ||
"typescript": "^3.5.3" | ||
}, | ||
"files": [ | ||
"lib" | ||
"/lib" | ||
], | ||
@@ -71,0 +70,0 @@ "optionalDependencies": {}, |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
114806
14
2405
0