(path: readonly PropertyKey[])
| 56 | : String(data) |
| 57 | |
| 58 | export const stringifyPath = (path: readonly PropertyKey[]): string => { |
| 59 | let result = "" |
| 60 | for (const segment of path) { |
| 61 | if (typeof segment === "string" && /^[$A-Z_a-z][\w$]*$/.test(segment)) |
| 62 | result += result ? `.${segment}` : segment |
| 63 | else |
| 64 | result += `[${typeof segment === "string" ? JSON.stringify(segment) : String(segment)}]` |
| 65 | } |
| 66 | return result |
| 67 | } |
| 68 | |
| 69 | export const editsBetween = (a: string, b: string): number => { |
| 70 | if (Math.abs(a.length - b.length) > 2) return 3 |