refactor: post editor
This commit is contained in:
parent
3d06421acb
commit
78725d1e88
31 changed files with 1603 additions and 766 deletions
|
|
@ -23,6 +23,13 @@ export function formatNpub(npub: string, length = 12) {
|
|||
return npub.slice(0, prefixLength) + '...' + npub.slice(-suffixLength)
|
||||
}
|
||||
|
||||
export function formatUserId(userId: string) {
|
||||
if (userId.startsWith('npub1')) {
|
||||
return formatNpub(userId)
|
||||
}
|
||||
return formatPubkey(userId)
|
||||
}
|
||||
|
||||
export function pubkeyToNpub(pubkey: string) {
|
||||
try {
|
||||
return nip19.npubEncode(pubkey)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue