diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-14 15:19:08 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-14 15:19:08 -0600 |
commit | 4a2170be49d901b101ba2835c6684d40250fec41 (patch) | |
tree | 63701b1ba950730f65d9eb44b2932fde8027aa35 /src/view/lib | |
parent | 4a0b79da4a716e4993c8767610c12b0f51cf9608 (diff) | |
download | voidsky-4a2170be49d901b101ba2835c6684d40250fec41.tar.zst |
Enforce limits on create scene as well
Diffstat (limited to 'src/view/lib')
-rw-r--r-- | src/view/lib/strings.ts | 11 |
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 +} |