From fa75cf71724cf4efc7b712d1a838dfc1875d7667 Mon Sep 17 00:00:00 2001 From: Tyler Beckman Date: Mon, 15 Apr 2024 15:32:47 -0600 Subject: [PATCH] thingy --- cli.ts | 11 +++++++++-- constants.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cli.ts b/cli.ts index 163d1ce..70f91de 100644 --- a/cli.ts +++ b/cli.ts @@ -34,7 +34,9 @@ for (const row of dom.querySelectorAll("tr")) { .filter((n) => n.nodeName === "TD") .map((n) => n.textContent.trim()); // Skip invalid entries - if (!institution || !location || !entry || !code || entry === "Names TBA") continue; + if (!institution || !location || !entry || !code || entry === "Names TBA") { + continue; + } entries.push({ institution, @@ -104,7 +106,12 @@ const nsdaSearchResults = await Promise schoolFilterUsed = true; nsdaLookup = nsdaLookup.filter((ee) => - ee.school_name.toLowerCase().includes(e.institution.toLowerCase()) + ee.school_name.replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase().includes( + e.institution.replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase(), + ) || + e.institution.replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase().includes( + ee.school_name.replace(/[^a-zA-Z0-9 -]/g, "").toLowerCase(), + ) ); } diff --git a/constants.ts b/constants.ts index de6ceb5..b057a07 100644 --- a/constants.ts +++ b/constants.ts @@ -6,4 +6,4 @@ export const overrides: Record< name: "Christopher Chavez", id: 10847338, }, -}; \ No newline at end of file +};