mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
25 lines
582 B
JavaScript
25 lines
582 B
JavaScript
import createCompounder from './_createCompounder.js';
|
|
|
|
/**
|
|
* Converts `string`, as space separated words, to lower case.
|
|
*
|
|
* @static
|
|
* @since 4.0.0
|
|
* @category String
|
|
* @param {string} [string=''] The string to convert.
|
|
* @returns {string} Returns the lower cased string.
|
|
* @example
|
|
*
|
|
* lowerCase('--Foo-Bar--');
|
|
* // => 'foo bar'
|
|
*
|
|
* lowerCase('fooBar');
|
|
* // => 'foo bar'
|
|
*
|
|
* lowerCase('__FOO_BAR__');
|
|
* // => 'foo bar'
|
|
*/
|
|
const lowerCase = createCompounder((result, word, index) => result + (index ? ' ' : '') + word.toLowerCase());
|
|
|
|
export default lowerCase;
|