Enforce limits on create scene as well

This commit is contained in:
Paul Frazee 2022-11-14 15:19:08 -06:00
parent 4a0b79da4a
commit 4a2170be49
3 changed files with 26 additions and 6 deletions

View file

@ -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
}