当前位置:网站首页>驼峰命名对像
驼峰命名对像
2022-04-23 06:25:00 【笔描相思】
function mapKeyToCamelCase(data) {
// 参考答案
const rename = (name) => {
return name.split('_').reduce((pre, current) => {
return pre + current[0].toUpperCase() + current.substring(1)
});
}
let res = Array.isArray(data) ? [] : {};
for (let i in data) {
if (typeof data[i] === 'object' && data[i] !== null) {
res[rename(i)] = mapKeyToCamelCase(data[i])
} else {
res[rename(i)] = data[i];
}
}
return res;
}
版权声明
本文为[笔描相思]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_44788119/article/details/120920501
边栏推荐
- Mobile game performance optimization
- Redis connection error err auth < password > called without any password configured for the default user
- H5 case development
- 7.子查询
- Visualization Road (IX) detailed explanation of arrow class
- js之DOM事件
- [hdu6833]A Very Easy Math Problem(莫比乌斯反演)
- [LNOI2014]LCA——树链剖分——多点LCA深度和问题
- SAP pi / PO rfc2soap publishes RFC interface as WS example
- SAP RFC_CVI_EI_INBOUND_MAIN BP主数据创建示例(仅演示客户)
猜你喜欢
随机推荐
Preliminary configuration of OpenGL super Dictionary (freeglut, glew, gltools, GLUT)
[self motivation series] you'll never be ready
1.查看数据库和表
Applet newline character \ nfailure problem resolution - Daily pit stepping
SAP PI/PO功能运行状态监控检查
每日一题 | 曾被反转链表支配的恐惧
3. Sort statement
npm 安装踩坑
莫比乌斯反演
Implementation of MySQL persistence
SAP CR传输请求顺序、依赖检查
4.多表查询
刨根问底---cocos2d源码的理解与分析
h5本地存储数据sessionStorage、localStorage
[2020WC Day2]F.采蘑菇的克拉莉丝(子树和查询、轻重儿子思想)
js之DOM学习三种创建元素的方式
4. Multi table query
7. sub query
安装配置淘宝镜像npm(cnpm)
Redis connection error err auth < password > called without any password configured for the default user








![[Educational Codeforces Round 80] 解题报告](/img/54/2fd298ddce3cd3e28a8fe42b3b8a42.png)
