Add scene creator
This commit is contained in:
@@ -71,3 +71,17 @@ export function extractEntities(text: string): Entity[] | undefined {
|
||||
}
|
||||
return ents.length > 0 ? ents : undefined
|
||||
}
|
||||
|
||||
export function makeValidHandle(str: string): string {
|
||||
if (str.length > 20) {
|
||||
str = str.slice(0, 20)
|
||||
}
|
||||
str = str.toLowerCase()
|
||||
return str.replace(/^[^a-z]+/g, '').replace(/[^a-z0-9-]/g, '')
|
||||
}
|
||||
|
||||
export function createFullHandle(name: string, domain: string): string {
|
||||
name = name.replace(/[\.]+$/, '')
|
||||
domain = domain.replace(/^[\.]+/, '')
|
||||
return `${name}.${domain}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user