(range: string)
| 27 | } from './constants' |
| 28 | |
| 29 | export function parseHyphen(range: string): string { |
| 30 | return range.replace( |
| 31 | parseRegex(hyphenRange), |
| 32 | ( |
| 33 | _range, |
| 34 | from, |
| 35 | fromMajor, |
| 36 | fromMinor, |
| 37 | fromPatch, |
| 38 | _fromPreRelease, |
| 39 | _fromBuild, |
| 40 | to, |
| 41 | toMajor, |
| 42 | toMinor, |
| 43 | toPatch, |
| 44 | toPreRelease |
| 45 | ) => { |
| 46 | if (isXVersion(fromMajor)) { |
| 47 | from = '' |
| 48 | } else if (isXVersion(fromMinor)) { |
| 49 | from = `>=${fromMajor}.0.0` |
| 50 | } else if (isXVersion(fromPatch)) { |
| 51 | from = `>=${fromMajor}.${fromMinor}.0` |
| 52 | } else { |
| 53 | from = `>=${from}` |
| 54 | } |
| 55 | |
| 56 | if (isXVersion(toMajor)) { |
| 57 | to = '' |
| 58 | } else if (isXVersion(toMinor)) { |
| 59 | to = `<${+toMajor + 1}.0.0-0` |
| 60 | } else if (isXVersion(toPatch)) { |
| 61 | to = `<${toMajor}.${+toMinor + 1}.0-0` |
| 62 | } else if (toPreRelease) { |
| 63 | to = `<=${toMajor}.${toMinor}.${toPatch}-${toPreRelease}` |
| 64 | } else { |
| 65 | to = `<=${to}` |
| 66 | } |
| 67 | |
| 68 | return `${from} ${to}`.trim() |
| 69 | } |
| 70 | ) |
| 71 | } |
| 72 | |
| 73 | export function parseComparatorTrim(range: string): string { |
| 74 | return range.replace(parseRegex(comparatorTrim), '$1$2$3') |
nothing calls this directly
no test coverage detected
searching dependent graphs…