当前位置:网站首页>驼峰命名对像
驼峰命名对像
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
边栏推荐
- 超级宝典&编程指南(红蓝宝书)-读书笔记
- What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)
- 10.更新操作
- 二叉树的深度
- ABAP 实现发布RESTful服务供外部调用示例
- 图论入门——建图
- 数据库查询优化的方式
- FSM有限状态机
- Background management system framework, there is always what you want
- Visualization Road (IX) detailed explanation of arrow class
猜你喜欢

SAP ECC连接SAP PI系统配置

SAP PI/PO rfc2RESTful 发布rfc接口为RESTful示例(Proxy间接法)

Reflection on the systematic design of Android audio and video caching mechanism

‘npm‘不是内部或外部命令,也不是可运行的程序 或批处理文件

Design optimization of MySQL database

Reflect on the limitations of event bus and the design and implementation of communication mechanism in component development process

FSM有限状态机

Super classic & Programming Guide (red and blue book) - Reading Notes

keytool: command not found

反思 | Android 音视频缓存机制的系统性设计
随机推荐
反思 | 事件总线的局限性,组件化开发流程中通信机制的设计与实现
Discussion on arrow function of ES6
SAP pi / PO rfc2soap publishes RFC interface as WS example
[牛客挑战赛47]C.条件 (bitset加速floyd)
ABAP 7.4 SQL Window Expression
F-牛妹的苹果树(直径合并)
Processing of common dependency module
[Ted series] how to get along with inner critics?
SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
王者荣耀-unity学习之旅
What are the total number of all courses of Mr. Tang Xiaoyang, who is very popular in CSDN (question mark)
游戏辅助脚本开发之旅
Hot change scheme and dynamic update strategy of mobile game
‘npm‘不是内部或外部命令,也不是可运行的程序 或批处理文件
如何判断点是否在多边形内(包含复杂多边形或者多边形数量很多的情况)
Moment.js中format方法函数的格式
每日一题 | 曾被反转链表支配的恐惧
[LNOI2014]LCA——树链剖分——多点LCA深度和问题
2.限定查询
手游的热更方案与动态更新策略