8 lines
162 B
JavaScript
8 lines
162 B
JavaScript
const underscore = function (str) {
|
|
return str.replace(/([A-Z])/g, function (_, match) {
|
|
return "_" + match.toLowerCase();
|
|
});
|
|
};
|
|
|
|
export { underscore };
|