mirror of
https://github.com/Kong/insomnia.git
synced 2026-06-04 06:10:24 -04:00
Move insomnia-data models, services, database code, and common utilities into a dedicated workspace package. Update consumers to import from the new package entrypoints and declare workspace dependencies for the extracted package.
16 lines
304 B
TypeScript
16 lines
304 B
TypeScript
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
/**
|
|
* Generate an ID of the format "<MODEL_NAME>_<TIMESTAMP><RANDOM>"
|
|
* @param prefix
|
|
* @returns {string}
|
|
*/
|
|
export function generateId(prefix?: string) {
|
|
const id = uuidv4().replace(/-/g, '');
|
|
|
|
if (prefix) {
|
|
return `${prefix}_${id}`;
|
|
}
|
|
return id;
|
|
}
|