fnUtils.ts
347 Bytes
export const copyTransFun = (arr: any[]) => {
arr.forEach((item) => {
if (item.name) {
item.label = item.name;
delete item.name;
}
if (item.id) {
item.value = item.id;
delete item.id;
}
if (item.children) {
if (item.children.length) {
copyTransFun(item.children);
}
}
});
};