( path: PropertyKey[], key?: PropertyKey )
| 89 | |
| 90 | // one or two keys are copied as a literal, which TurboFan allocates inline |
| 91 | export const pathAt = ( |
| 92 | path: PropertyKey[], |
| 93 | key?: PropertyKey |
| 94 | ): PropertyKey[] => { |
| 95 | if (key !== undefined) path.push(key) |
| 96 | const copy = |
| 97 | path.length === 1 ? [path[0]] |
| 98 | : path.length === 2 ? [path[0], path[1]] |
| 99 | : path.slice() |
| 100 | if (key !== undefined) path.pop() |
| 101 | return copy |
| 102 | } |
no test coverage detected