123456789101112 |
- export const arr2obj = (data, keyName, valueName) =>
- Object.fromEntries(data.map((item) => [item[keyName], item[valueName]]));
- export const hump2Underline = (str) =>
- str.replace(/([A-Z])/g, "_$1").toLowerCase();
- export const underline2Hump = (str) => {
- for (let match of str.match(/_(.)/g)) {
- str = str.replace(match, match.replace("_", "")).toUpperCase();
- }
- return str;
- };
|