|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
825 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Generates a unique identifier, optionally prefixed with a given string.
|
|---|
| 3 | *
|
|---|
| 4 | * @param {string} [prefix] - An optional string to prefix the unique identifier.
|
|---|
| 5 | * If not provided or not a string, only the unique
|
|---|
| 6 | * numeric identifier is returned.
|
|---|
| 7 | * @returns {string} A string containing the unique identifier, with the optional
|
|---|
| 8 | * prefix if provided.
|
|---|
| 9 | *
|
|---|
| 10 | * @example
|
|---|
| 11 | * // Generate a unique ID with a prefix
|
|---|
| 12 | * uniqueId('user_'); // => 'user_1'
|
|---|
| 13 | *
|
|---|
| 14 | * @example
|
|---|
| 15 | * // Generate a unique ID without a prefix
|
|---|
| 16 | * uniqueId(); // => '2'
|
|---|
| 17 | *
|
|---|
| 18 | * @example
|
|---|
| 19 | * // Subsequent calls increment the internal counter
|
|---|
| 20 | * uniqueId('item_'); // => 'item_3'
|
|---|
| 21 | * uniqueId(); // => '4'
|
|---|
| 22 | */
|
|---|
| 23 | declare function uniqueId(prefix?: string): string;
|
|---|
| 24 |
|
|---|
| 25 | export { uniqueId };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.