0c18acc452
* chore(core): move limits logic into shared * feat(comments): limit text and rawText for comments * chore(core): removed test moved to shared * chore(comments): generate gql types * feat(comments): rework comment history limits * chore(comments): fix tests * chore(shared): add dayjs as dependency --------- Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
23 lines
545 B
TypeScript
23 lines
545 B
TypeScript
import crs from 'crypto-random-string'
|
|
|
|
export function createRandomEmail() {
|
|
return randomizeCase(`${crs({ length: 6 })}@example.org`)
|
|
}
|
|
|
|
export function createRandomPassword(length?: number) {
|
|
return crs({ length: length ?? 10 })
|
|
}
|
|
|
|
/**
|
|
* @deprecated use the one in shared
|
|
*/
|
|
export function createRandomString(length?: number) {
|
|
return crs({ length: length ?? 10 })
|
|
}
|
|
|
|
export const randomizeCase = (str: string) =>
|
|
str
|
|
.split('')
|
|
.map((char) => (Math.random() > 0.5 ? char.toUpperCase() : char.toLowerCase()))
|
|
.join('')
|