microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/typings/semver/semver.d.ts
129lines · modecode
| 1 | // Type definitions for semver v2.2.1 |
| 2 | // Project: https://github.com/isaacs/node-semver |
| 3 | // Definitions by: Bart van der Schoor <https://github.com/Bartvds> |
| 4 | // Definitions: https://github.com/borisyankov/DefinitelyTyped |
| 5 | |
| 6 | declare module SemVerModule { |
| 7 | /** |
| 8 | * Return the parsed version, or null if it's not valid. |
| 9 | */ |
| 10 | function valid(v: string, loose?: boolean): string; |
| 11 | /** |
| 12 | * Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. |
| 13 | */ |
| 14 | function inc(v: string, release: string, loose?: boolean): string; |
| 15 | /** |
| 16 | * Return the cleaned version, or null if it's not valid. |
| 17 | */ |
| 18 | function clean(v: string, loose?: boolean): string; |
| 19 | |
| 20 | // Comparison |
| 21 | /** |
| 22 | * v1 > v2 |
| 23 | */ |
| 24 | function gt(v1: string, v2: string, loose?: boolean): boolean; |
| 25 | /** |
| 26 | * v1 >= v2 |
| 27 | */ |
| 28 | function gte(v1: string, v2: string, loose?: boolean): boolean; |
| 29 | /** |
| 30 | * v1 < v2 |
| 31 | */ |
| 32 | function lt(v1: string, v2: string, loose?: boolean): boolean; |
| 33 | /** |
| 34 | * v1 <= v2 |
| 35 | */ |
| 36 | function lte(v1: string, v2: string, loose?: boolean): boolean; |
| 37 | /** |
| 38 | * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. |
| 39 | */ |
| 40 | function eq(v1: string, v2: string, loose?: boolean): boolean; |
| 41 | /** |
| 42 | * v1 != v2 The opposite of eq. |
| 43 | */ |
| 44 | function neq(v1: string, v2: string, loose?: boolean): boolean; |
| 45 | /** |
| 46 | * Pass in a comparison string, and it'll call the corresponding semver comparison function. "===" and "!==" do simple string comparison, but are included for completeness. Throws if an invalid comparison string is provided. |
| 47 | */ |
| 48 | function cmp(v1: string, comparator: any, v2: string, loose?: boolean): boolean; |
| 49 | /** |
| 50 | * Return 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort(). |
| 51 | */ |
| 52 | function compare(v1: string, v2: string, loose?: boolean): number; |
| 53 | /** |
| 54 | * The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort(). |
| 55 | */ |
| 56 | function rcompare(v1: string, v2: string, loose?: boolean): number; |
| 57 | |
| 58 | // Ranges |
| 59 | /** |
| 60 | * Return the valid range or null if it's not valid |
| 61 | */ |
| 62 | function validRange(range: string, loose?: boolean): string; |
| 63 | /** |
| 64 | * Return true if the version satisfies the range. |
| 65 | */ |
| 66 | function satisfies(version: string, range: string, loose?: boolean): boolean; |
| 67 | /** |
| 68 | * Return the highest version in the list that satisfies the range, or null if none of them do. |
| 69 | */ |
| 70 | function maxSatisfying(versions: string[], range: string, loose?: boolean): string; |
| 71 | /** |
| 72 | * Return true if version is greater than all the versions possible in the range. |
| 73 | */ |
| 74 | function gtr(version: string, range: string, loose?: boolean): boolean; |
| 75 | /** |
| 76 | * Return true if version is less than all the versions possible in the range. |
| 77 | */ |
| 78 | function ltr(version: string, range: string, loose?: boolean): boolean; |
| 79 | /** |
| 80 | * Return true if the version is outside the bounds of the range in either the high or low direction. The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) |
| 81 | */ |
| 82 | function outside(version: string, range: string, hilo: string, loose?: boolean): boolean; |
| 83 | |
| 84 | class SemVerBase { |
| 85 | raw: string; |
| 86 | loose: boolean; |
| 87 | format(): string; |
| 88 | inspect(): string; |
| 89 | toString(): string; |
| 90 | } |
| 91 | |
| 92 | class SemVer extends SemVerBase { |
| 93 | constructor(version: string, loose?: boolean); |
| 94 | |
| 95 | major: number; |
| 96 | minor: number; |
| 97 | patch: number; |
| 98 | version: string; |
| 99 | build: string[]; |
| 100 | prerelease: string[]; |
| 101 | |
| 102 | compare(other:SemVer): number; |
| 103 | compareMain(other:SemVer): number; |
| 104 | comparePre(other:SemVer): number; |
| 105 | inc(release: string): SemVer; |
| 106 | } |
| 107 | |
| 108 | class Comparator extends SemVerBase { |
| 109 | constructor(comp: string, loose?: boolean); |
| 110 | |
| 111 | semver: SemVer; |
| 112 | operator: string; |
| 113 | value: boolean; |
| 114 | parse(comp: string): void; |
| 115 | test(version:SemVer): boolean; |
| 116 | } |
| 117 | |
| 118 | class Range extends SemVerBase { |
| 119 | constructor(range: string, loose?: boolean); |
| 120 | |
| 121 | set: Comparator[][]; |
| 122 | parseRange(range: string): Comparator[]; |
| 123 | test(version: SemVer): boolean; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | declare module "semver" { |
| 128 | export = SemVerModule; |
| 129 | } |
| 130 | |