* Heuristic: a value is a `NodeName` (intended as the `as` variable) * if it is a plain string matching a Python identifier pattern, or a * Symbol.
(value: unknown)
| 216 | * Symbol. |
| 217 | */ |
| 218 | private _isNodeName(value: unknown): boolean { |
| 219 | if (typeof value === 'string') { |
| 220 | return /^[A-Za-z_]\w*$/.test(value); |
| 221 | } |
| 222 | // Symbols from codegen-core have `~brand` |
| 223 | if (value && typeof value === 'object' && '~brand' in value) { |
| 224 | return true; |
| 225 | } |
| 226 | return false; |
| 227 | } |
| 228 | } |