File size: 433 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { nanoid } from 'nanoid/non-secure';
/**
 * A function that generates a random id
 * @returns An id
 */
export function generateId() {
    return nanoid(10);
}
export function generateIds(args) {
    return args.reduce((acc, curr) => {
        acc[curr] = generateId();
        return acc;
    }, {});
}
export function stringifiedIdObjType(args) {
    return `Record<${args.map((arg) => `"${arg}"`).join(' | ')}, string>`;
}