From f37c767fbc804846f29d8e47d6c49fc68dfd5bf0 Mon Sep 17 00:00:00 2001 From: ItsVipra Date: Tue, 18 Jul 2023 12:24:08 +0200 Subject: [PATCH] match capitalised pronouns in bio --- src/libs/pronouns.js | 5 ++++- tests/extractPronouns.spec.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/pronouns.js b/src/libs/pronouns.js index 8fcfd56..fb1268f 100644 --- a/src/libs/pronouns.js +++ b/src/libs/pronouns.js @@ -284,7 +284,10 @@ const knownPronouns = [ function extractFromBio(bio) { const exactMatches = bio.matchAll(/(\w+) ?\/ ?(\w+)/gi); for (const [match, subjective, objective] of exactMatches) { - if (knownPronouns.includes(subjective) && knownPronouns.includes(objective)) { + if ( + knownPronouns.includes(subjective.toLowerCase()) && + knownPronouns.includes(objective.toLowerCase()) + ) { return match.replaceAll(" ", ""); } } diff --git a/tests/extractPronouns.spec.js b/tests/extractPronouns.spec.js index eda8e8b..8ec74f6 100644 --- a/tests/extractPronouns.spec.js +++ b/tests/extractPronouns.spec.js @@ -104,6 +104,7 @@ const bioExtractTests = [ ["I'm cute af (she / they)", "she/they"], // with whitespace between pronouns ["pronouns: any/all", "any/all"], // any pronouns ["any pronouns", "any pronouns"], // any pronouns + ["He/Him", "He/Him"], //capitalised pronouns ]; for (const [input, expects] of bioExtractTests) { bioExtractSuite(input, async () => {