(self: Comparator, includePrerelease: boolean)
| 520 | } |
| 521 | |
| 522 | const expand = (self: Comparator, includePrerelease: boolean): ReadonlyArray<Bound> => { |
| 523 | const z = includePrerelease ? [0] : [] |
| 524 | if (self._tag === "Hyphen") { |
| 525 | const { from, to } = self |
| 526 | // Unlike `>=`, a full hyphen lower bound without a pre-release also takes `z`. |
| 527 | const lower = from.components.length === 0 |
| 528 | ? [] |
| 529 | : [bound(">=", from.components, from.prerelease.length > 0 ? from.prerelease : z)] |
| 530 | return [...lower, ...expandXRange("<=", to, z)] |
| 531 | } |
| 532 | switch (self.operator) { |
| 533 | case "^": |
| 534 | return expandCaret(self.version, z) |
| 535 | case "~": |
| 536 | return expandTilde(self.version, z) |
| 537 | default: |
| 538 | return expandXRange(self.operator, self.version, z) |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | const testBound = (self: Bound, version: SemVer): boolean => { |
| 543 | const result = compareCore(version, self) |
no test coverage detected