Generates a unique ID. If `prefix` is given, the ID is appended to it.
uniqueId('contact_')
// => 'contact_104'
uniqueId()
// => '105'
| Name | Type | Attribute | Description |
|---|---|---|---|
| prefix | The value to prefix the ID with. |
{
"comment": "/**\r\n * Generates a unique ID. If `prefix` is given, the ID is appended to it.\r\n *\r\n * @since 0.1.0\r\n * @category Util\r\n * @param {string} [prefix=''] The value to prefix the ID with.\r\n * @returns {string} Returns the unique ID.\r\n * @see random\r\n * @example\r\n *\r\n * uniqueId('contact_')\r\n * // => 'contact_104'\r\n *\r\n * uniqueId()\r\n * // => '105'\r\n */",
"meta": {
"range": [
410,
495
],
"filename": "uniqueId.js",
"lineno": 20,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100011256",
"name": "uniqueId",
"type": "FunctionDeclaration",
"paramnames": [
"prefix"
]
},
"vars": {
"id": "uniqueId~id"
}
},
"description": "Generates a unique ID. If `prefix` is given, the ID is appended to it.",
"since": "0.1.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Util",
"value": "Util"
}
],
"params": [
{
"type": {
"names": [
"string"
]
},
"optional": true,
"defaultvalue": "''",
"description": "The value to prefix the ID with.",
"name": "prefix"
}
],
"returns": [
{
"type": {
"names": [
"string"
]
},
"description": "Returns the unique ID."
}
],
"see": [
"random"
],
"examples": [
"uniqueId('contact_')\r// => 'contact_104'\r\runiqueId()\r// => '105'"
],
"name": "uniqueId",
"longname": "uniqueId",
"kind": "function",
"scope": "global",
"___id": "T000002R001022",
"___s": true,
"filepath": "uniqueId.js"
}