(path: Path, canBeFirstKey: boolean)
| 210 | } |
| 211 | |
| 212 | function getPathString(path: Path, canBeFirstKey: boolean): string { |
| 213 | const pathString = path |
| 214 | .map((key, i) => { |
| 215 | if (typeof key === 'number') { |
| 216 | return `[${key}]` |
| 217 | } |
| 218 | if (i === 0 && canBeFirstKey && isKeyDotNotationCompatible(key)) { |
| 219 | return key |
| 220 | } |
| 221 | return getPropAccessNotation(key) |
| 222 | }) |
| 223 | .join('') |
| 224 | return pathString |
| 225 | } |
| 226 | function getPropAccessNotation(key: unknown): `.${string}` | `[${string}]` { |
| 227 | return typeof key === 'string' && isKeyDotNotationCompatible(key) ? `.${key}` : `[${JSON.stringify(key)}]` |
| 228 | } |
no test coverage detected
searching dependent graphs…