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

camelCase.js 701B

1234567891011121314151617181920212223242526272829
  1. var capitalize = require('./capitalize'),
  2. createCompounder = require('./_createCompounder');
  3. /**
  4. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  5. *
  6. * @static
  7. * @memberOf _
  8. * @since 3.0.0
  9. * @category String
  10. * @param {string} [string=''] The string to convert.
  11. * @returns {string} Returns the camel cased string.
  12. * @example
  13. *
  14. * _.camelCase('Foo Bar');
  15. * // => 'fooBar'
  16. *
  17. * _.camelCase('--foo-bar--');
  18. * // => 'fooBar'
  19. *
  20. * _.camelCase('__FOO_BAR__');
  21. * // => 'fooBar'
  22. */
  23. var camelCase = createCompounder(function(result, word, index) {
  24. word = word.toLowerCase();
  25. return result + (index ? capitalize(word) : word);
  26. });
  27. module.exports = camelCase;