| 72 | * } |
| 73 | */ |
| 74 | export const testPath = (pathList: (string | number)[], testPathList: string[], flag = true) => { |
| 75 | const NOT_PASS_RES = { |
| 76 | pass: false, |
| 77 | }; |
| 78 | if (!flag || pathList.length !== testPathList.length) { |
| 79 | return NOT_PASS_RES; |
| 80 | } |
| 81 | const res: { |
| 82 | [key: string]: any |
| 83 | } = { pass: true }; |
| 84 | |
| 85 | for (let i = 0; i < testPathList.length; i++) { |
| 86 | if (testPathList[i]!.startsWith(':')) { |
| 87 | const pathKey = testPathList[i]!.slice(1); |
| 88 | res[pathKey] = pathList[i]; |
| 89 | continue; |
| 90 | } |
| 91 | if (pathList[i] !== testPathList[i]) { |
| 92 | return NOT_PASS_RES; |
| 93 | } |
| 94 | } |
| 95 | return res; |
| 96 | }; |
| 97 | |
| 98 | export const shallowEqual = (objA: any, objB: any) => { |
| 99 | if (objA === objB) { |