2 module.exports = function (str, sep) {
3 if (typeof str !== 'string') {
4 throw new TypeError('Expected a string');
7 sep = typeof sep === 'undefined' ? '_' : sep;
10 .replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
11 .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')