`[PartHead, v]` for an entry variable `v` → the part tag, else null.
( x: MathJSON, variables: ReadonlyArray<string> )
| 257 | x: MathJSON, |
| 258 | variables: ReadonlyArray<string> |
| 259 | ): { part: 're' | 'im' | 'abs' | 'arg'; v: string } | null { |
| 260 | if ( |
| 261 | Array.isArray(x) && |
| 262 | x.length === 2 && |
| 263 | typeof x[0] === 'string' && |
| 264 | x[0] in PART_HEADS && |
| 265 | typeof x[1] === 'string' && |
| 266 | variables.includes(x[1]) |
| 267 | ) |
| 268 | return { part: PART_HEADS[x[0]], v: x[1] }; |
| 269 | return null; |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * Compile entry assumptions to a GuardSpec list. Fail-closed: any conjunct |
| 274 | * outside the mapping table makes the whole entry uncompilable. |
| 275 | */ |
| 276 | export function compileGuards( |