UNPKG

433 BJavaScriptView Raw
1var toString = require('../lang/toString');
2var slugify = require('./slugify');
3var unCamelCase = require('./unCamelCase');
4 /**
5 * Replaces spaces with underscores, split camelCase text, remove non-word chars, remove accents and convert to lower case.
6 */
7 function underscore(str){
8 str = toString(str);
9 str = unCamelCase(str);
10 return slugify(str, "_");
11 }
12 module.exports = underscore;
13