about summary refs log tree commit diff
path: root/src/view/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/lib')
-rw-r--r--src/view/lib/strings.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/view/lib/strings.ts b/src/view/lib/strings.ts
index 26e1b04e2..19bd5c473 100644
--- a/src/view/lib/strings.ts
+++ b/src/view/lib/strings.ts
@@ -1,6 +1,9 @@
 import {AtUri} from '../../third-party/uri'
 import {Entity} from '../../third-party/api/src/client/types/app/bsky/feed/post'
 
+export const MAX_DISPLAY_NAME = 64
+export const MAX_DESCRIPTION = 256
+
 export function pluralize(n: number, base: string, plural?: string): string {
   if (n === 1) {
     return base
@@ -85,3 +88,11 @@ export function createFullHandle(name: string, domain: string): string {
   domain = domain.replace(/^[\.]+/, '')
   return `${name}.${domain}`
 }
+
+export function enforceLen(str: string, len: number): string {
+  str = str || ''
+  if (str.length > len) {
+    return str.slice(0, len)
+  }
+  return str
+}