安装
npm i naming-style
使用示例
const { style, camel, pascal, hyphen, constant, snake, underscore, setence } = require("naming-style"); // 检测文本的命名风格 console.log(style('name')); // underscore console.log(style('Name')); // underscore console.log(style('userName')); // camel console.log(style('user_name')); // snake console.log(style('UserName')); // pascal // 命名风格转换 console.log(camel('user_name')); // userName console.log(pascal('user_name')); // UserName console.log(snake('UserName')); // user_name console.log(hyphen('UserName')); // user-name console.log(constant('UserName')); // USER_NAME