@twec/ip-parser
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -32,3 +32,3 @@ const etl = require('etl'); | ||
async function parseFile(filename) { | ||
function parseFileAsStream(filename) { | ||
let currentContainer = null; | ||
@@ -39,3 +39,3 @@ let currentOrder = null; | ||
const containers = await etl | ||
const containers = etl | ||
.file(filename) | ||
@@ -67,5 +67,7 @@ .pipe(etl.split()) | ||
if (parsed) { | ||
const isSameShipGroup = currentOrder.shipGroupPackageNumber | ||
=== parsed.shipGroupPackageNumber; | ||
const hasAllLines = parsed.numberOfOrderDetailRecords === currentOrder.lines.length; | ||
const isSameShipGroup = | ||
currentOrder.shipGroupPackageNumber === | ||
parsed.shipGroupPackageNumber; | ||
const hasAllLines = | ||
parsed.numberOfOrderDetailRecords === currentOrder.lines.length; | ||
if (isSameShipGroup && hasAllLines) { | ||
@@ -84,4 +86,4 @@ currentContainer.orders.push(currentOrder); | ||
if ( | ||
parsed.numberOfOrderHeaderRecords | ||
=== currentContainer.orders.length | ||
parsed.numberOfOrderHeaderRecords === | ||
currentContainer.orders.length | ||
) { | ||
@@ -98,4 +100,3 @@ this.push(currentContainer); | ||
}), | ||
) | ||
.promise(); | ||
); | ||
@@ -105,5 +106,13 @@ return containers; | ||
/** | ||
* | ||
*/ | ||
async function parseFile(filename) { | ||
return parseFileAsStream(filename).promise(); | ||
} | ||
module.exports = { | ||
parse, | ||
parseFile, | ||
parseFileAsStream, | ||
}; |
{ | ||
"name": "@twec/ip-parser", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Parser for Island Pacific orders", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "1a656cfe50443ac63f46ecc2067003f22b1f2079", | ||
"gitHead": "2ba73532a79c1b7f6c34d9e0fb17be952090479e", | ||
"publishConfig": { | ||
@@ -35,0 +35,0 @@ "access": "public" |
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
15416
445