add run script to package.json

This commit is contained in:
Chuck Dries 2021-08-09 17:19:58 -07:00
parent 75015f8ada
commit 3eade05163
2 changed files with 4 additions and 5 deletions

View File

@ -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);

View File

@ -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"