Created
January 2, 2025 16:51
-
-
Save codemile/485efdcc4b7088bf42f31a610c922c44 to your computer and use it in GitHub Desktop.
Utility function to trim a public key string to a specified size with ellipsis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function trimPublicKey(publicKey: string, size: number): string { | |
return publicKey.length <= size * 2 | |
? publicKey | |
: `${publicKey.slice(0, size)}...${publicKey.slice(-size)}`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment