source: trip-planner-front/node_modules/lodash/uniqueId.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 562 bytes
Line 
1var toString = require('./toString');
2
3/** Used to generate unique IDs. */
4var idCounter = 0;
5
6/**
7 * Generates a unique ID. If `prefix` is given, the ID is appended to it.
8 *
9 * @static
10 * @since 0.1.0
11 * @memberOf _
12 * @category Util
13 * @param {string} [prefix=''] The value to prefix the ID with.
14 * @returns {string} Returns the unique ID.
15 * @example
16 *
17 * _.uniqueId('contact_');
18 * // => 'contact_104'
19 *
20 * _.uniqueId();
21 * // => '105'
22 */
23function uniqueId(prefix) {
24 var id = ++idCounter;
25 return toString(prefix) + id;
26}
27
28module.exports = uniqueId;
Note: See TracBrowser for help on using the repository browser.