当前位置:网站首页>处理数据 给数据换名字
处理数据 给数据换名字
2022-07-27 23:56:00 【MMNHD】

a:[
{"手机号":1321312123,'姓名':'啊牛'},
{"手机号":888888,'姓名':'王五'},
],
b:{
'姓名':'user',
'手机号':'mobile'
}
要的格式 [
{user:'啊牛'},
{mobile:1321312123}
]
export function getImportJsData(results, header) {
const newArr = []
// 将所有的中文key转换成英文key 然后添加到新数组中
results.forEach(item => {
const map = {}
Object.keys(item).forEach(key => {
map[header[key]] = item[key]
})
newArr.push(map)
})
// 时间处理
newArr.forEach(item => {
Object.keys(item).forEach(key => {
if (key === 'timeOfEntry') {
item[key] = new Date(formatDate(item[key], '/'))
}
})
})
return newArr
}
getImportJsData(a,b) 
边栏推荐
- EEG多元模式分析预测慈善捐赠行为
- Niuke net question brushing training (III)
- GBase 8c 事务ID和快照(四)
- Software test interview question: how to find problems related to the database?
- 普通设备能不能接入TSN时间敏感网络?
- Blizzard Diablo 4 ps5 / PS4 beta added to Playstation database
- 2.2综合应用题-顺序表
- 小散量化炒股记|量化系统中数据是源头,教你搭建一款普适的数据源框架
- HCIP第十五天
- 还在用WIFI你就OUT了:LI-FI更牛!!!
猜你喜欢
随机推荐
Can anime characters become "real people"? Paddegan helps you find the TA of "tear man"
【分布式开发】之 CAP 原则
文章复现:超分辨率网络FSRCNN
腾讯云HiFlow场景连接器
HRD 1. 一个简单而靠谱的HRD的检测方法
Prediction of charitable donation behavior by EEG multivariate model analysis
Article reproduction: super resolution network fsrcnn
一些事情的思考
The story of the third uncle
GBase 8c 备份控制函数(一)
Niuke net question brushing training (III)
Brushes and brushes
以“数字化渠道”撬动家用电器消费蓝海,经销商在线系统让企业生意更进一步
GBase 8c 事务ID和快照(四)
Software test interview question: how to find problems related to the database?
同心向前,Google Play 十周年啦!
三舅的故事
普通设备能不能接入TSN时间敏感网络?
物企大变局时代,SRM供应商采购系统助力企业打造物业采购数字化标杆
JS数字精度丢失的原因及解决方案









