Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80765 views
1
'use strict';
2
module.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