@catbee/utils
Version:
A modular, production-grade utility toolkit for Node.js and TypeScript, designed for robust, scalable applications (including Express-based services). All utilities are tree-shakable and can be imported independently.
36 lines • 1.27 kB
TypeScript
/**
* Generates a UUID v4 string (RFC 4122).
*
* @returns {string} UUID v4 (e.g., 'c0de1234-5678-9abc-def0-123456789abc')
*/
export declare function uuid(): string;
/**
* Generates a nanoid-style random ID (URL-safe, customizable length).
*
* @param {number} length - Length of the ID (default: 21).
* @returns {string} Nanoid-style random string.
*/
export declare function nanoId(length?: number): string;
/**
* Generates a cryptographically strong random hex string.
*
* @param {number} byteLength - Number of random bytes (default: 16 → 32 hex chars).
* @returns {string} Random hex string.
*/
export declare function randomHex(byteLength?: number): string;
/**
* Generates a random integer between min (inclusive) and max (inclusive).
*
* @param {number} min - Minimum value.
* @param {number} max - Maximum value.
* @returns {number} Random integer in range.
*/
export declare function randomInt(min: number, max: number): number;
/**
* Generates a cryptographically strong random base64 string.
*
* @param {number} byteLength - Number of random bytes (default: 16).
* @returns {string} Random base64 string (URL-safe, no padding).
*/
export declare function randomBase64(byteLength?: number): string;
//# sourceMappingURL=id.utils.d.ts.map