@e-group/redux-modules
Version:
eGroup team react-redux modules that share across projects.
19 lines (16 loc) • 397 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = camalize;
/**
* Change action type to camalize style.
* Example,
* COMPONENTS/FETCH_GET_USER -> components/fetchGetUser
*/
function camalize(str) {
if (str === str.toUpperCase()) {
return str.toLowerCase().replace(/[^a-zA-Z0-9/]+(.)/g, (m, chr) => chr.toUpperCase());
}
return str;
}