mirror of
https://github.com/ItsVipra/ProToots
synced 2024-11-21 19:13:03 +00:00
match capitalised pronouns in bio
This commit is contained in:
parent
380a865c84
commit
f37c767fbc
2 changed files with 5 additions and 1 deletions
|
@ -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(" ", "");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 () => {
|
||||
|
|
Loading…
Reference in a new issue