[ABANDONED] API server for Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

24 lines
577 B

import { v1 } from 'uuid'
export function trimContent(content?: string, length: number = 128): string {
if (!content) return ''
if (content.length < length) return content.trim()
return content.slice(0, length).trim()
}
export function createPostId(): string {
return 'p' + v1().replace(/-/g, '')
}
export function createInvitationCode(): string {
return 'i' + v1().replace(/-/g, '')
}
export function wait(ms: number = 5000): Promise<void> {
return new Promise(resolve => {
setTimeout(() => {
resolve()
}, ms)
})
}