A factory for collision-free synthetic def names within a known name set.
(existing)
| 73 | |
| 74 | /** A factory for collision-free synthetic def names within a known name set. */ |
| 75 | function nameAllocator(existing) { |
| 76 | const taken = new Set(existing) |
| 77 | return (candidate) => { |
| 78 | let name = candidate |
| 79 | let n = 2 |
| 80 | while (taken.has(name)) name = `${candidate}${n++}` |
| 81 | taken.add(name) |
| 82 | return name |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | /** True when `entry` is a reference to a named group (`{Type:'group', Value}`). */ |
| 87 | function isGroupRef(entry) { |
no test coverage detected