# recursive **Repository Path**: tj123/recursive ## Basic Information - **Project Name**: recursive - **Description**: 普通数组转为递归数据 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-08-16 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 递归数据转换 ```js const d = [{ id: 1, pid: undefined, name:'sdgds' },[ id: 2, pid:1, name: 'asdgss' ]]; // 普通数据转换为 递归数据 const dt = toRecu(d,undefined,'id','pid','children'); console.log(JSON.stringify(dt)); //最后的数据 [ { "id": 1, "name": "sdgds", "children": [ { "id": 2, "pid": 1, "name": "asdgss" } ] } ] ```