id
Module: vibex/id
ID Generator Utilities for VibeX
Simple, unique ID generation for documents and other entities.
Functions
generateShortId
View sourceGenerate a short, unique ID that’s URL-safe Uses a custom alphabet to ensure compatibility
function generateShortId(length: number = 8): stringParameters:
| Name | Type | Description |
|---|---|---|
length | number | Length of the ID (default: 8) (default: 8) |
Returns: A short, unique ID string
generateSpaceId
View sourceGenerate a space ID
function generateSpaceId(): stringReturns: A space ID like ‘aB3x_9Kp’ (always clean random ID)
validateId
View sourceValidate a document ID Checks that the ID starts with a letter and contains only letters, numbers, and underscores
function validateId(id: string): booleanParameters:
| Name | Type | Description |
|---|---|---|
id | string | ID string to validate |
Returns: Boolean indicating if the ID is valid