Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kebabCase.js 659B

12345678910111213141516171819202122232425262728
  1. var createCompounder = require('./_createCompounder');
  2. /**
  3. * Converts `string` to
  4. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  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 kebab cased string.
  12. * @example
  13. *
  14. * _.kebabCase('Foo Bar');
  15. * // => 'foo-bar'
  16. *
  17. * _.kebabCase('fooBar');
  18. * // => 'foo-bar'
  19. *
  20. * _.kebabCase('__FOO_BAR__');
  21. * // => 'foo-bar'
  22. */
  23. var kebabCase = createCompounder(function(result, word, index) {
  24. return result + (index ? '-' : '') + word.toLowerCase();
  25. });
  26. module.exports = kebabCase;