@azizbecha/strkit
Version:
strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.
12 lines (11 loc) • 355 B
TypeScript
/**
* Generates a unique alphanumeric ID of a specified length.
*
* @param length - The length of the generated ID (default is 10).
* @returns A randomly generated alphanumeric ID.
*
* @example
* generateId(); // Output: "a1b2c3d4e5"
* generateId(16); // Output: "f9g8h7j6k5l4m3n2"
*/
export default function generateId(length?: number): string;