(sorted: string[], term: string)
| 480 | /** adds a term in order, since a union's say nothing, or false if it's a repeat, whose |
| 481 | * union could reduce to what isn't scanned */ |
| 482 | const insert = (sorted: string[], term: string) => { |
| 483 | let i = sorted.length |
| 484 | while (i && sorted[i - 1] > term) i-- |
| 485 | if (sorted[i - 1] === term) return false |
| 486 | sorted.splice(i, 0, term) |
| 487 | return true |
| 488 | } |
| 489 | |
| 490 | const insertAll = (terms: string[], f: Facts) => |
| 491 | f.terms ? f.terms.every(t => insert(terms, t)) : insert(terms, f.key) |