1'use strict'; 2module.exports = function (str, sep) { 3 if (typeof str !== 'string') { 4 throw new TypeError('Expected a string'); 5 } 6 7 return str.replace(/([a-z\d])([A-Z])/g, '$1' + (sep || '_') + '$2').toLowerCase(); 8}; 9 10