Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

12345678910111213141516171819202122232425262728
  1. var toString = require('./toString');
  2. /** Used to generate unique IDs. */
  3. var idCounter = 0;
  4. /**
  5. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  6. *
  7. * @static
  8. * @since 0.1.0
  9. * @memberOf _
  10. * @category Util
  11. * @param {string} [prefix=''] The value to prefix the ID with.
  12. * @returns {string} Returns the unique ID.
  13. * @example
  14. *
  15. * _.uniqueId('contact_');
  16. * // => 'contact_104'
  17. *
  18. * _.uniqueId();
  19. * // => '105'
  20. */
  21. function uniqueId(prefix) {
  22. var id = ++idCounter;
  23. return toString(prefix) + id;
  24. }
  25. module.exports = uniqueId;