(a, b)
| 322 | * @returns {RuntimeSpec} merged |
| 323 | */ |
| 324 | const intersectRuntime = (a, b) => { |
| 325 | if (a === undefined) { |
| 326 | return b; |
| 327 | } else if (b === undefined) { |
| 328 | return a; |
| 329 | } else if (a === b) { |
| 330 | return a; |
| 331 | } else if (typeof a === "string") { |
| 332 | if (typeof b === "string") { |
| 333 | return; |
| 334 | } else if (b.has(a)) { |
| 335 | return a; |
| 336 | } |
| 337 | return; |
| 338 | } |
| 339 | if (typeof b === "string") { |
| 340 | if (a.has(b)) return b; |
| 341 | return; |
| 342 | } |
| 343 | /** @type {RuntimeSpecSortableSet} */ |
| 344 | const set = new SortableSet(); |
| 345 | for (const item of b) { |
| 346 | if (a.has(item)) set.add(item); |
| 347 | } |
| 348 | if (set.size === 0) return; |
| 349 | if (set.size === 1) { |
| 350 | const [item] = set; |
| 351 | return item; |
| 352 | } |
| 353 | return set; |
| 354 | }; |
| 355 | |
| 356 | /** |
| 357 | * Returns result. |
no test coverage detected