underscored.js 176 Bytes Raw Blame History Permalink 1 2 3 4 5 var trim = require('./trim'); module.exports = function underscored(str) { return trim(str).replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/[-\s]+/g, '_').toLowerCase(); };