UNPKG

lazyid

Version:

Minimal 16-character URL-safe unique ID generator based on a millisecond timestamp, encoded in Base36.

10 lines (9 loc) 361 B
/** * Generates a minimal 16-character URL-safe unique ID. * If an ID is provided, it decodes the timestamp from it. * @param id Optional ID to decode. * @returns A 16-character unique ID if no argument is provided, * or the decoded timestamp (number) if an ID is provided. */ declare function lazyid(id?: string): string | number; export default lazyid;