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:
659 bytes
|
Line | |
---|
1 | var createCompounder = require('./_createCompounder');
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Converts `string` to
|
---|
5 | * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
|
---|
6 | *
|
---|
7 | * @static
|
---|
8 | * @memberOf _
|
---|
9 | * @since 3.0.0
|
---|
10 | * @category String
|
---|
11 | * @param {string} [string=''] The string to convert.
|
---|
12 | * @returns {string} Returns the kebab cased string.
|
---|
13 | * @example
|
---|
14 | *
|
---|
15 | * _.kebabCase('Foo Bar');
|
---|
16 | * // => 'foo-bar'
|
---|
17 | *
|
---|
18 | * _.kebabCase('fooBar');
|
---|
19 | * // => 'foo-bar'
|
---|
20 | *
|
---|
21 | * _.kebabCase('__FOO_BAR__');
|
---|
22 | * // => 'foo-bar'
|
---|
23 | */
|
---|
24 | var kebabCase = createCompounder(function(result, word, index) {
|
---|
25 | return result + (index ? '-' : '') + word.toLowerCase();
|
---|
26 | });
|
---|
27 |
|
---|
28 | module.exports = kebabCase;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.