Skip to content

Commit

Permalink
match capitalised pronouns in bio
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsVipra committed Jul 18, 2023
1 parent 380a865 commit f37c767
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libs/pronouns.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ", "");
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/extractPronouns.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit f37c767

Please sign in to comment.