( self: SemVerRange, versions: Iterable<VersionInput>, options: MatchOptions | undefined, better: -1 | 1 )
| 630 | ) |
| 631 | |
| 632 | const select = ( |
| 633 | self: SemVerRange, |
| 634 | versions: Iterable<VersionInput>, |
| 635 | options: MatchOptions | undefined, |
| 636 | better: -1 | 1 |
| 637 | ): Option.Option<SemVer> => { |
| 638 | const test = matcher(self, options) |
| 639 | let selected: SemVer | undefined |
| 640 | for (const input of versions) { |
| 641 | const version = versionFromInputUnsafe(input) |
| 642 | if (test(version) && (selected === undefined || compareCore(version, selected) === better)) { |
| 643 | selected = version |
| 644 | } |
| 645 | } |
| 646 | return Option.fromUndefinedOr(selected) |
| 647 | } |
| 648 | |
| 649 | /** |
| 650 | * Returns the version with the highest precedence that a range matches. |
no test coverage detected