feat(Tool): 添加重命名对象属性的功能

- 新增 renameObjectKeys 函数,用于根据字段映射表重新命名对象的属性
- 函数接受过滤后的行数据数组和字段映射表作为参数
- 返回一个新的数组,其中对象的属性根据字段映射表进行了重命名
- 如果字段不在映射表中,则直接跳过,不加入新对象
This commit is contained in:
2025-02-24 22:13:47 +08:00
parent caeca23cfa
commit 5d696abd78
3 changed files with 28 additions and 3 deletions

1
types/index.d.ts vendored
View File

@@ -14,4 +14,5 @@ declare module 'ddmt-tool' {
export function toCookiesArray(cookies: string): { [key: string]: string };
export function updateCookies(cookies: string, setCookieArray: string[]): string;
export function objectToJSON(ObjectText: string): string | undefined;
export function renameObjectKeys(filteredRows: Array<{ [key: string]: any }>, fieldMapping: { [key: string]: string }): Array<{ [key: string]: any }>;
}