Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / string / kebabCase.js
1 var createCompounder = require('../internal/createCompounder');
2
3 /**
4  * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
5  *
6  * @static
7  * @memberOf _
8  * @category String
9  * @param {string} [string=''] The string to convert.
10  * @returns {string} Returns the kebab cased string.
11  * @example
12  *
13  * _.kebabCase('Foo Bar');
14  * // => 'foo-bar'
15  *
16  * _.kebabCase('fooBar');
17  * // => 'foo-bar'
18  *
19  * _.kebabCase('__foo_bar__');
20  * // => 'foo-bar'
21  */
22 var kebabCase = createCompounder(function(result, word, index) {
23   return result + (index ? '-' : '') + word.toLowerCase();
24 });
25
26 module.exports = kebabCase;