Urara-Blog/node_modules/.pnpm-store/v3/files/f3/42b25d934a969c4561d9696507d7df806046e9529c84e1b5f5d1d3cc3bf86ecf9d09c79a8d478b8fe562860adbbb88a5dfcc717f2e9962a08b43902115f7d5
2022-08-14 01:14:53 +08:00

28 lines
638 B
Text

var createCompounder = require('./_createCompounder');
/**
* Converts `string` to
* [snake case](https://en.wikipedia.org/wiki/Snake_case).
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the snake cased string.
* @example
*
* _.snakeCase('Foo Bar');
* // => 'foo_bar'
*
* _.snakeCase('fooBar');
* // => 'foo_bar'
*
* _.snakeCase('--FOO-BAR--');
* // => 'foo_bar'
*/
var snakeCase = createCompounder(function(result, word, index) {
return result + (index ? '_' : '') + word.toLowerCase();
});
module.exports = snakeCase;