From e104a826c49ed012ffcfa2997a0a2e325b82379e Mon Sep 17 00:00:00 2001 From: BarkleyRhoat Date: Thu, 7 May 2026 09:39:17 -0400 Subject: [PATCH 1/4] added findMatching function --- index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d8bbce056..8ceaa4bd2 100644 --- a/index.js +++ b/index.js @@ -1 +1,13 @@ -// Code your solution here +function findMatching(collection, name) { + return collection.filter(function (driver) { + return driver.toLowerCase() === name.toLowerCase() + }) + } + +function fuzzyMatch() { + +} + +function matchName() { + +} \ No newline at end of file From 3b75fd932a70f416830179c3360aee027c501659 Mon Sep 17 00:00:00 2001 From: BarkleyRhoat Date: Thu, 7 May 2026 11:21:30 -0400 Subject: [PATCH 2/4] changed findMatching function to arrow, created fuzzyMatch with .filter() --- index.js | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/index.js b/index.js index 8ceaa4bd2..d3fad9198 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,20 @@ -function findMatching(collection, name) { - return collection.filter(function (driver) { - return driver.toLowerCase() === name.toLowerCase() - }) - } - -function fuzzyMatch() { - -} - -function matchName() { - -} \ No newline at end of file +// function findMatching(collection, name) { +// return collection.filter(function (driver) { +// return driver.toLowerCase() === name.toLowerCase(); +// }); +// } +const findMatching = (collection, name) => + collection.filter((driver) => driver.toLowerCase() === name.toLowerCase()); + + +// function fuzzyMatch(collection, name) { +// return collection.filter(function (driver) { +// return driver.startsWith(name) +// }) +// } +const fuzzyMatch = (collection, name) => + collection.filter((driver) => driver.startsWith(name)) + + + +function matchName() {} From 24adfdb8f4beb70c892995713c917f93ace85e6d Mon Sep 17 00:00:00 2001 From: BarkleyRhoat Date: Thu, 7 May 2026 11:30:15 -0400 Subject: [PATCH 3/4] added array of drivers for logging purposes --- index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index d3fad9198..19e049ad7 100644 --- a/index.js +++ b/index.js @@ -1,20 +1,19 @@ +const drivers = ["Bobby", "Sammy", "Sally", "Annette", "Sarah", "Bobby"]; // added for logging purposes + // function findMatching(collection, name) { // return collection.filter(function (driver) { // return driver.toLowerCase() === name.toLowerCase(); // }); // } const findMatching = (collection, name) => - collection.filter((driver) => driver.toLowerCase() === name.toLowerCase()); - + collection.filter((driver) => driver.toLowerCase() === name.toLowerCase()); // function fuzzyMatch(collection, name) { // return collection.filter(function (driver) { // return driver.startsWith(name) // }) // } -const fuzzyMatch = (collection, name) => - collection.filter((driver) => driver.startsWith(name)) - - +const fuzzyMatch = (collection, name) => + collection.filter((driver) => driver.startsWith(name)); function matchName() {} From da1d67604f902c4da992373b206a85011b6aa36e Mon Sep 17 00:00:00 2001 From: BarkleyRhoat Date: Thu, 7 May 2026 11:51:31 -0400 Subject: [PATCH 4/4] created matchName function --- index.js | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 19e049ad7..03324e39b 100644 --- a/index.js +++ b/index.js @@ -1,19 +1,53 @@ -const drivers = ["Bobby", "Sammy", "Sally", "Annette", "Sarah", "Bobby"]; // added for logging purposes +// added for logging purposes +const drivers = [ + { + name: "Bobby", + hometown: "Pittsburgh", + }, + { + name: "Sammy", + hometown: "New York", + }, + { + name: "Sally", + hometown: "Cleveland", + }, + { + name: "Annette", + hometown: "Los Angeles", + }, + { + name: "Bobby", + hometown: "Tampa Bay", + }, +]; + + +const findMatching = (collection, name) => + collection.filter((driver) => driver.toLowerCase() === name.toLowerCase()); + + +const fuzzyMatch = (collection, name) => + collection.filter((driver) => driver.startsWith(name)); + + +const matchName = (collection, name) => + collection.filter((driver) => driver.name === name); // function findMatching(collection, name) { // return collection.filter(function (driver) { // return driver.toLowerCase() === name.toLowerCase(); // }); // } -const findMatching = (collection, name) => - collection.filter((driver) => driver.toLowerCase() === name.toLowerCase()); // function fuzzyMatch(collection, name) { // return collection.filter(function (driver) { // return driver.startsWith(name) // }) // } -const fuzzyMatch = (collection, name) => - collection.filter((driver) => driver.startsWith(name)); -function matchName() {} +// function matchName(collection, name) { +// return collection.filter(function (driver) { +// return driver.name === name +// }) +// } \ No newline at end of file