@types/semver
Advanced tools
Comparing version 6.0.2 to 6.2.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for semver 6.0 | ||
// Type definitions for semver 6.2 | ||
// Project: https://github.com/npm/node-semver | ||
@@ -7,2 +7,3 @@ // Definitions by: Bart van der Schoor <https://github.com/Bartvds> | ||
// Klaus Meinhardt <https://github.com/ajafff> | ||
// ExE Boss <https://github.com/ExE-Boss> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/semver | ||
@@ -19,39 +20,62 @@ | ||
export interface CoerceOptions extends Options { | ||
/** | ||
* Used by `coerce()` to coerce from right to left. | ||
* | ||
* @default false | ||
* | ||
* @example | ||
* coerce('1.2.3.4', { rtl: true }); | ||
* // => SemVer { version: '2.3.4', ... } | ||
* | ||
* @since 6.2.0 | ||
*/ | ||
rtl?: boolean; | ||
} | ||
/** | ||
* Return the parsed version as a SemVer object, or null if it's not valid. | ||
*/ | ||
export function parse(v: string | SemVer, optionsOrLoose?: boolean | Options): SemVer | null; | ||
export function parse(version: string | SemVer | null | undefined, optionsOrLoose?: boolean | Options): SemVer | null; | ||
/** | ||
* Return the parsed version, or null if it's not valid. | ||
* Return the parsed version as a string, or null if it's not valid. | ||
*/ | ||
export function valid(v: string | SemVer, optionsOrLoose?: boolean | Options): string | null; | ||
export function valid(version: string | SemVer | null | undefined, optionsOrLoose?: boolean | Options): string | null; | ||
/** | ||
* Coerces a string to SemVer if possible | ||
*/ | ||
export function coerce(version: string | number | SemVer | null | undefined, options?: CoerceOptions): SemVer | null; | ||
/** | ||
* Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid. | ||
*/ | ||
export function clean(version: string, optionsOrLoose?: boolean | Options): string | null; | ||
/** | ||
* Return the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. | ||
*/ | ||
export function inc(v: string | SemVer, release: ReleaseType, optionsOrLoose?: boolean | Options, identifier?: string): string | null; | ||
export function inc( | ||
v: string | SemVer, | ||
release: ReleaseType, | ||
identifier?: string, | ||
): string | null; | ||
export function inc(version: string | SemVer, release: ReleaseType, optionsOrLoose?: boolean | Options, identifier?: string): string | null; | ||
export function inc(version: string | SemVer, release: ReleaseType, identifier?: string): string | null; | ||
/** | ||
* Return the major version number. | ||
*/ | ||
export function major(v: string | SemVer, optionsOrLoose?: boolean | Options): number; | ||
export function major(version: string | SemVer, optionsOrLoose?: boolean | Options): number; | ||
/** | ||
* Return the minor version number. | ||
*/ | ||
export function minor(v: string | SemVer, optionsOrLoose?: boolean | Options): number; | ||
export function minor(version: string | SemVer, optionsOrLoose?: boolean | Options): number; | ||
/** | ||
* Return the patch version number. | ||
*/ | ||
export function patch(v: string | SemVer, optionsOrLoose?: boolean | Options): number; | ||
export function patch(version: string | SemVer, optionsOrLoose?: boolean | Options): number; | ||
/** | ||
* Returns an array of prerelease components, or null if none exist. | ||
*/ | ||
export function prerelease(v: string | SemVer, optionsOrLoose?: boolean | Options): ReadonlyArray<string> | null; | ||
export function prerelease(version: string | SemVer, optionsOrLoose?: boolean | Options): ReadonlyArray<string> | null; | ||
@@ -93,7 +117,16 @@ // Comparison | ||
/** | ||
* 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(). | ||
* Compares two versions excluding build identifiers (the bit after `+` in the semantic version string). | ||
* | ||
* Sorts in ascending order when passed to `Array.sort()`. | ||
* | ||
* @return | ||
* - `0` if `v1` == `v2` | ||
* - `1` if `v1` is greater | ||
* - `-1` if `v2` is greater. | ||
*/ | ||
export function compare(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): 1 | 0 | -1; | ||
/** | ||
* The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort(). | ||
* The reverse of compare. | ||
* | ||
* Sorts in descending order when passed to `Array.sort()`. | ||
*/ | ||
@@ -103,16 +136,34 @@ export function rcompare(v1: string | SemVer, v2: string | SemVer, optionsOrLoose?: boolean | Options): 1 | 0 | -1; | ||
/** | ||
* Compares two identifiers, must be numeric strings or truthy/falsy values. Sorts in ascending order if passed to Array.sort(). | ||
* Compares two identifiers, must be numeric strings or truthy/falsy values. | ||
* | ||
* Sorts in ascending order when passed to `Array.sort()`. | ||
*/ | ||
export function compareIdentifiers(a: string | null, b: string | null): 1 | 0 | -1; | ||
export function compareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1; | ||
/** | ||
* The reverse of compareIdentifiers. Sorts in descending order when passed to Array.sort(). | ||
* The reverse of compareIdentifiers. | ||
* | ||
* Sorts in descending order when passed to `Array.sort()`. | ||
*/ | ||
export function rcompareIdentifiers(a: string | null, b: string | null): 1 | 0 | -1; | ||
export function rcompareIdentifiers(a: string | null | undefined, b: string | null | undefined): 1 | 0 | -1; | ||
/** | ||
* Sorts an array of semver entries in ascending order. | ||
* Compares two versions including build identifiers (the bit after `+` in the semantic version string). | ||
* | ||
* Sorts in ascending order when passed to `Array.sort()`. | ||
* | ||
* @return | ||
* - `0` if `v1` == `v2` | ||
* - `1` if `v1` is greater | ||
* - `-1` if `v2` is greater. | ||
* | ||
* @since 6.1.0 | ||
*/ | ||
export function compareBuild(a: string | SemVer, b: string | SemVer): 1 | 0 | -1; | ||
/** | ||
* Sorts an array of semver entries in ascending order using `compareBuild()`. | ||
*/ | ||
export function sort<T extends string | SemVer>(list: T[], optionsOrLoose?: boolean | Options): T[]; | ||
/** | ||
* Sorts an array of semver entries in descending order. | ||
* Sorts an array of semver entries in descending order using `compareBuild()`. | ||
*/ | ||
@@ -130,3 +181,3 @@ export function rsort<T extends string | SemVer>(list: T[], optionsOrLoose?: boolean | Options): T[]; | ||
*/ | ||
export function validRange(range: string | Range, optionsOrLoose?: boolean | Options): string; | ||
export function validRange(range: string | Range | null | undefined, optionsOrLoose?: boolean | Options): string; | ||
/** | ||
@@ -166,8 +217,2 @@ * Return true if the version satisfies the range. | ||
// Coercion | ||
/** | ||
* Coerces a string to semver if possible | ||
*/ | ||
export function coerce(version: string | SemVer): SemVer | null; | ||
export class SemVer { | ||
@@ -189,5 +234,42 @@ constructor(version: string | SemVer, optionsOrLoose?: boolean | Options); | ||
/** | ||
* Compares two versions excluding build identifiers (the bit after `+` in the semantic version string). | ||
* | ||
* @return | ||
* - `0` if `this` == `other` | ||
* - `1` if `this` is greater | ||
* - `-1` if `other` is greater. | ||
*/ | ||
compare(other: string | SemVer): 1 | 0 | -1; | ||
/** | ||
* Compares the release portion of two versions. | ||
* | ||
* @return | ||
* - `0` if `this` == `other` | ||
* - `1` if `this` is greater | ||
* - `-1` if `other` is greater. | ||
*/ | ||
compareMain(other: string | SemVer): 1 | 0 | -1; | ||
/** | ||
* Compares the prerelease portion of two versions. | ||
* | ||
* @return | ||
* - `0` if `this` == `other` | ||
* - `1` if `this` is greater | ||
* - `-1` if `other` is greater. | ||
*/ | ||
comparePre(other: string | SemVer): 1 | 0 | -1; | ||
/** | ||
* Compares the build identifier of two versions. | ||
* | ||
* @return | ||
* - `0` if `this` == `other` | ||
* - `1` if `this` is greater | ||
* - `-1` if `other` is greater. | ||
*/ | ||
compareBuild(other: string | SemVer): 1 | 0 | -1; | ||
inc(release: ReleaseType, identifier?: string): SemVer; | ||
@@ -194,0 +276,0 @@ } |
{ | ||
"name": "@types/semver", | ||
"version": "6.0.2", | ||
"version": "6.2.0", | ||
"description": "TypeScript definitions for semver", | ||
@@ -26,2 +26,7 @@ "license": "MIT", | ||
"githubUsername": "ajafff" | ||
}, | ||
{ | ||
"name": "ExE Boss", | ||
"url": "https://github.com/ExE-Boss", | ||
"githubUsername": "ExE-Boss" | ||
} | ||
@@ -38,4 +43,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "0ffdfe2b476714b6b1ceaddc1afadc4f372c4b28ccecd13cc0e598c0b3d56516", | ||
"typesPublisherContentHash": "f19d7b1ca506ce2f282d80a2b72e499a5dc5afed849026bc6a56307e1030e70a", | ||
"typeScriptVersion": "2.0" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Thu, 05 Sep 2019 18:12:22 GMT | ||
* Last updated: Fri, 25 Oct 2019 20:12:50 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Bart van der Schoor <https://github.com/Bartvds>, BendingBender <https://github.com/BendingBender>, Lucian Buzzo <https://github.com/LucianBuzzo>, and Klaus Meinhardt <https://github.com/ajafff>. | ||
These definitions were written by Bart van der Schoor <https://github.com/Bartvds>, BendingBender <https://github.com/BendingBender>, Lucian Buzzo <https://github.com/LucianBuzzo>, Klaus Meinhardt <https://github.com/ajafff>, and ExE Boss <https://github.com/ExE-Boss>. |
13855
265