in lib/helper.js [199:224]
function _snakeCase(str) {
if (!str) {
return '';
}
let res = '';
let tmp = '';
for (const c of str) {
if (/[A-Z|0-9]/.test(c)) {
tmp += c;
} else {
if (tmp.length > 0) {
res += res === '' ? tmp.toLowerCase() : '_' + tmp.toLowerCase();
tmp = '';
}
res += c;
}
}
if (tmp.length > 0) {
res += '_' + tmp.toLowerCase();
}
res = res.replace(/-/g, '_');
if (res[0] === '_' && str[0] !== '_') {
res = res.substring(1);
}
return res;
}