~james/core

core/web/src/lib/api/profileIdentifier.ts -rw-r--r-- 422 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
import type { ActorIdentifier, Did, Handle } from "@atcute/lexicons/syntax";

export const INVALID_HANDLE = "handle.invalid" satisfies Handle;

export const profileIdentifier = (handle: Handle | undefined, did: Did): ActorIdentifier =>
	handle && handle !== INVALID_HANDLE ? handle : did;

export const canonicalHandle = (handle: Handle | undefined): Handle | null =>
	handle && handle !== INVALID_HANDLE ? handle : null;