Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
sommilito-bank2
/
splide-4.1.3
/
src
/
js
/
utils
/
string
/
uniqueId
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
import { pad } from '../pad/pad'; /** * Stores unique IDs. * * @since 3.0.0 */ const ids: Record<string, number> = {}; /** * Returns a sequential unique ID as "{ prefix }-{ number }". * * @param prefix - A prefix for the ID. */ export function uniqueId( prefix: string ): string { return `${ prefix }${ pad( ( ids[ prefix ] = ( ids[ prefix ] || 0 ) + 1 ) ) }`; }