(path: unknown[])
| 43 | } |
| 44 | |
| 45 | function getFinalTargetMap(path: unknown[]) { |
| 46 | let currentTarget = root; |
| 47 | |
| 48 | for (let part of path) { |
| 49 | if (part === undefined) part = undefinedSymbol; |
| 50 | if (checkEquality) { |
| 51 | const currentReuser = currentTarget.get( |
| 52 | equalReuserSymbol |
| 53 | ) as EqualValueReuser; |
| 54 | part = currentReuser(part); |
| 55 | } |
| 56 | |
| 57 | if (currentTarget.has(part)) { |
| 58 | currentTarget = currentTarget.get(part) as AnyMap; |
| 59 | continue; |
| 60 | } |
| 61 | |
| 62 | const nestedMap = new MapToUse(); |
| 63 | |
| 64 | if (checkEquality) { |
| 65 | nestedMap.set(equalReuserSymbol, createValueReuser()); |
| 66 | } |
| 67 | |
| 68 | currentTarget.set(part, nestedMap); |
| 69 | |
| 70 | currentTarget = nestedMap; |
| 71 | } |
| 72 | |
| 73 | return currentTarget; |
| 74 | } |
| 75 | |
| 76 | function has(path: unknown[]) { |
| 77 | const targetMap = getFinalTargetMap(path); |
no test coverage detected