mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
12 lines
276 B
JavaScript
12 lines
276 B
JavaScript
|
const CHARS = '023456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ'.split('');
|
||
|
|
||
|
export function generateId (prefix) {
|
||
|
let id = `${prefix}_${Date.now()}-`;
|
||
|
|
||
|
for (let i = 0; i < 10; i++) {
|
||
|
id += CHARS[Math.floor(Math.random() * CHARS.length)];
|
||
|
}
|
||
|
|
||
|
return id;
|
||
|
}
|