UNPKG

@e-group/redux-modules

Version:

eGroup team react-redux modules that share across projects.

12 lines (11 loc) 303 B
/** * Change action type to camalize style. * Example, * COMPONENTS/FETCH_GET_USER -> components/fetchGetUser */ export default function camalize(str) { if (str === str.toUpperCase()) { return str.toLowerCase().replace(/[^a-zA-Z0-9/]+(.)/g, (m, chr) => chr.toUpperCase()); } return str; }