mirror of
https://github.com/snachodog/tok-to-insta-follower-bridge.git
synced 2025-05-12 12:32:22 -06:00
20 lines
640 B
TypeScript
20 lines
640 B
TypeScript
import type { ProfileView } from "@atproto/api/dist/client/types/app/bsky/actor/defs"
|
|
|
|
export const isSimilarUser = (terms: string[], bskyProfile: ProfileView | undefined) => {
|
|
if(!bskyProfile) { return false }
|
|
|
|
return terms.some(term => {
|
|
const lowerCaseName = term.toLocaleLowerCase()
|
|
if(lowerCaseName === bskyProfile?.handle.toLocaleLowerCase().replace("@", "").split('.')[0]) {
|
|
return true
|
|
}
|
|
if(lowerCaseName === bskyProfile.displayName?.toLocaleLowerCase()) {
|
|
return true
|
|
}
|
|
if(bskyProfile.description?.toLocaleLowerCase().includes(lowerCaseName)) {
|
|
return true
|
|
}
|
|
return false
|
|
})
|
|
}
|