Skip to Content

Id utils

import { uuid, generateId } from '@gg-software/utils';

uuid

RFC 4122 v4 UUID. Uses crypto.randomUUID when available, with a crypto.getRandomValues fallback.

uuid(); // "6f9619ff-8b86-4d01-b42d-00cf4fc964ff"

generateId

Short unique id for DOM ids / list keys — non-crypto, unique within the process, not globally. Use uuid for anything persisted.

generateId(); // "k3f9zq01" generateId('field'); // "field-k3f9zq02"
ParameterTypeDefault
prefixstringnone — joined with - when given