当前位置:网站首页>Hump naming object
Hump naming object
2022-04-23 08:05:00 【Pen drawing Acacia】
function mapKeyToCamelCase(data) {
// Refer to the answer
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;
}
版权声明
本文为[Pen drawing Acacia]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230624332465.html
边栏推荐
- MySQL--锁的奥秘--数据怎么锁
- BUFFCTF文件中的秘密1
- LeetCoed18. 四数之和
- RAID0和RAID5的创建和模拟RAID5工作原理
- 面试学习路线
- CTF-MISC学习之从开始到放弃
- MySQL -- the secret of lock -- how to lock data
- Reading notes
- Intranet penetration series: icmptunnel of Intranet tunnel (Master James Barlow's)
- Link to some good tutorials or notes about network security and record them
猜你喜欢
SAP GUI security
惨了,搞坏了领导的机密文件,吐血分享备份文件的代码技巧
Sto with billing cross company inventory dump return
Go语学习笔记 - 结构体 | 从零开始Go语言
Chapter VII asset impairment
三星,再次“西征”
Analysis of Nacos source code
简述CPU
随笔(不定时更新)
Internal network security attack and defense: a practical guide to penetration testing (5): analysis and defense of horizontal movement in the domain
随机推荐
3C装配中的机械臂运动规划
Intranet penetration series: pingtunnel of Intranet tunnel
內網滲透系列:內網隧道之icmpsh
Anti shake and throttling
[problem solving] vs2019 solves the problem that the EXE file generated by compilation cannot be opened
Mysql database backup and recovery under Linux (full + incremental)
以下程序实现从字符串str中删除第i个字符开始的连续n个字
LeetCode 1611. 使整数变为 0 的最少操作次数
Cloud computing skills competition -- the first part of openstack private cloud environment
读书笔记
一文了解系列,对web渗透的常见漏洞总结(持续更新)
SAP tr manual import system operation manual
简述存储器的分级策略
爬虫学习笔记,学习爬虫,看本篇就够了
Essays (updated from time to time)
一些靶场的学习记录:sqli-labs、upload-labs、XSS
upload-labs 靶场练习
LeetCoed18. 四数之和
Solidity IDE Remix中文版使用手册
Introduction to sap query enhanced development