typedash
Version:
modern, type-safe collection of utility functions
29 lines • 872 B
TypeScript
//#region src/functions/uniqueId/uniqueId.d.ts
/**
* Generates a unique identifier.
*
* If a `prefix` is provided, the resulting identifier will start with the prefix.
* @param prefix A prefix for the identifier.
* @returns A unique identifier.
* @example
* ```ts
* uniqueId('prefix-') // 'prefix-1q2w3e4r5t'
* ```
*/
declare function uniqueId<Prefix extends string>(prefix: Prefix): `${Prefix}${string}`;
/**
* Generates a unique identifier.
*
* If no `prefix` is provided, the resulting identifier will not have a prefix.
* @param prefix An optional prefix for the identifier.
* @returns A unique identifier.
* @example
* ```ts
* uniqueId() // '1q2w3e4r5t'
* uniqueId('prefix-') // 'prefix-1q2w3e4r5t'
* ```
*/
declare function uniqueId(prefix?: string): string;
//#endregion
export { uniqueId as t };
//# sourceMappingURL=uniqueId-BC1PVtPM.d.ts.map