- 新增 renameObjectKeys 函数,用于根据字段映射表重新命名对象的属性 - 函数接受过滤后的行数据数组和字段映射表作为参数 - 返回一个新的数组,其中对象的属性根据字段映射表进行了重命名 - 如果字段不在映射表中,则直接跳过,不加入新对象
64 lines
1.2 KiB
JavaScript
64 lines
1.2 KiB
JavaScript
/*
|
|
* @Author: ddmt
|
|
* @version: 1.0.11
|
|
* @Date: 2024-9-29 20:50:12
|
|
* @LastEditTime: 2025-2-18 00:55:00
|
|
* @LastEditors: ddmt
|
|
* @Description: ddmt-index file
|
|
* @FilePath: /index.js
|
|
*/
|
|
|
|
// 导入所有函数
|
|
import {
|
|
animateStart,
|
|
setClassVar,
|
|
getStyleVar
|
|
} from './Tool/animate.js';
|
|
|
|
import {
|
|
randomNum,
|
|
nextArray,
|
|
ArrayDeHeavy,
|
|
getRelativeTime,
|
|
parseNginxLog,
|
|
toCookiesArray,
|
|
updateCookies,
|
|
objectToJSON,
|
|
renameObjectKeys
|
|
} from './Tool/number.js';
|
|
|
|
// ES Module 导出
|
|
export {
|
|
animateStart,
|
|
setClassVar,
|
|
getStyleVar,
|
|
randomNum,
|
|
nextArray,
|
|
ArrayDeHeavy,
|
|
getRelativeTime,
|
|
parseNginxLog,
|
|
toCookiesArray,
|
|
updateCookies,
|
|
objectToJSON,
|
|
renameObjectKeys
|
|
};
|
|
|
|
// CommonJS 导出
|
|
if (typeof module !== 'undefined' && module.exports) {
|
|
module.exports = {
|
|
animateStart,
|
|
setClassVar,
|
|
getStyleVar,
|
|
randomNum,
|
|
nextArray,
|
|
ArrayDeHeavy,
|
|
getRelativeTime,
|
|
parseNginxLog,
|
|
toCookiesArray,
|
|
updateCookies,
|
|
objectToJSON,
|
|
renameObjectKeys
|
|
};
|
|
}
|
|
|
|
console.log('ddmt-tool Loading successfully!! 😺'); |