SkateSpots/.agents/skills/note-content/files/lib/getDisplayName.ts
shakespeare.diy 06fae294b8 New project created with Shakespeare
Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
2026-06-15 19:49:07 +07:00

14 lines
454 B
TypeScript

import type { NostrMetadata } from '@nostrify/nostrify';
/**
* Get a display name for a user.
* Uses metadata.name if available, otherwise falls back to "Anonymous".
* Visual truncation is handled by CSS (`truncate` class) on the containing element
* to avoid breaking NIP-30 custom emoji shortcodes.
*/
export function getDisplayName(
metadata: NostrMetadata | undefined,
_pubkey: string,
): string {
return metadata?.name || 'Anonymous';
}