(name: string)
| 153 | |
| 154 | // the option a mistyped one is nearest to, within two edits |
| 155 | const nearestOptionTo = (name: string): string | undefined => { |
| 156 | let nearest: string | undefined |
| 157 | let fewest = 3 |
| 158 | for (const option of [...Object.keys(optionNames), ...nodeKinds]) { |
| 159 | const edits = editsBetween(name.toLowerCase(), option.toLowerCase()) |
| 160 | if (edits < fewest) [nearest, fewest] = [option, edits] |
| 161 | } |
| 162 | return nearest |
| 163 | } |
| 164 | |
| 165 | const undeclaredKeyBehaviors = { reject: 1, delete: 1, ignore: 1 } |
| 166 |
no test coverage detected