From 3eade0516340caae4df5704ac2a5e586a2a84c79 Mon Sep 17 00:00:00 2001 From: Chuck Dries Date: Mon, 9 Aug 2021 17:19:58 -0700 Subject: [PATCH] add run script to package.json --- index.js | 5 ++--- package.json | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index badc807..bc0199e 100755 --- a/index.js +++ b/index.js @@ -7,8 +7,7 @@ const leadsById = {}; // index IDs by email for easy lookup const leadIdssByEmail = {}; -const collisions = []; - +// deduplicate leads for (const currentLead of leads) { const { _id, email } = currentLead; @@ -23,7 +22,6 @@ for (const currentLead of leads) { right: currentLead, collidingField: collidingLeadIdByEmail ? "email" : "_id", }; - collisions.push(collision); const lDate = new Date(collision.left.entryDate); const rDate = new Date(collision.right.entryDate); if (lDate > rDate) { @@ -80,5 +78,6 @@ fs.writeFileSync( console.log("records processed:", leads.length); console.log("collisions:", collisions.length); console.log("output leads:", Object.keys(leadsById).length); +console.log("leads written to deduplicatedLeads.json"); console.log("collisions", collisions); diff --git a/package.json b/package.json index 2c405b6..9c1d5ae 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "adobe-coding-challenge", + "name": "lead-deduplication", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "run": "node index.js" }, "author": "", "license": "ISC"