myt/lib/util.js

8 lines
141 B
JavaScript
Raw Normal View History

function camelToSnake(str) {
return str.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`);
}
module.exports = {
camelToSnake
};