Version 1
[yaffs-website] / node_modules / grunt-legacy-log / node_modules / lodash / string / snakeCase.js
diff --git a/node_modules/grunt-legacy-log/node_modules/lodash/string/snakeCase.js b/node_modules/grunt-legacy-log/node_modules/lodash/string/snakeCase.js
new file mode 100644 (file)
index 0000000..c9ebffd
--- /dev/null
@@ -0,0 +1,26 @@
+var createCompounder = require('../internal/createCompounder');
+
+/**
+ * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).
+ *
+ * @static
+ * @memberOf _
+ * @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;