Package-level declarations

Types

Link copied to clipboard
external interface CoerceOptions : Options
Link copied to clipboard
external class Comparator
Link copied to clipboard
sealed external interface ComparatorOperator
Link copied to clipboard
sealed external interface IdentifierBase

Base number to be used for the prerelease identifier

Link copied to clipboard
sealed external interface Operator
Link copied to clipboard
external interface Options
Link copied to clipboard
sealed external interface OutsideHilo
Link copied to clipboard
external class Range
Link copied to clipboard
external interface RangeOptions : Options
Link copied to clipboard
sealed external interface ReleaseType
Link copied to clipboard
external class SemVer

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
external fun clean(version: String): String?
external fun clean(version: String, optionsOrLoose: Boolean = definedExternally): String?
external fun clean(version: String, optionsOrLoose: Options = definedExternally): String?

Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid.

Link copied to clipboard
external fun cmp(v1: String, operator: Operator, v2: String): Boolean
external fun cmp(v1: String, operator: Operator, v2: SemVer): Boolean
external fun cmp(v1: SemVer, operator: Operator, v2: String): Boolean
external fun cmp(v1: SemVer, operator: Operator, v2: SemVer): Boolean
external fun cmp(v1: String, operator: Operator, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun cmp(v1: String, operator: Operator, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun cmp(v1: String, operator: Operator, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun cmp(v1: String, operator: Operator, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean
external fun cmp(v1: SemVer, operator: Operator, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun cmp(v1: SemVer, operator: Operator, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun cmp(v1: SemVer, operator: Operator, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun cmp(v1: SemVer, operator: Operator, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean

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.

Link copied to clipboard
external fun coerce(version: Number?, options: CoerceOptions = definedExternally): SemVer?
external fun coerce(version: String?, options: CoerceOptions = definedExternally): SemVer?
external fun coerce(version: SemVer?, options: CoerceOptions = definedExternally): SemVer?

Coerces a string to SemVer if possible

Link copied to clipboard
external fun compare(v1: String, v2: String): Int
external fun compare(v1: String, v2: SemVer): Int
external fun compare(v1: SemVer, v2: String): Int
external fun compare(v1: SemVer, v2: SemVer): Int
external fun compare(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Int
external fun compare(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Int
external fun compare(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun compare(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Int
external fun compare(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Int
external fun compare(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Int
external fun compare(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun compare(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Int

Compares two versions excluding build identifiers (the bit after + in the semantic version string).

Link copied to clipboard
external fun compareBuild(a: String, b: String): Int
external fun compareBuild(a: String, b: SemVer): Int
external fun compareBuild(a: SemVer, b: String): Int
external fun compareBuild(a: SemVer, b: SemVer): Int
external fun compareBuild(a: String, b: String, optionsOrLoose: Boolean = definedExternally): Int
external fun compareBuild(a: String, b: String, optionsOrLoose: Options = definedExternally): Int
external fun compareBuild(a: String, b: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun compareBuild(a: String, b: SemVer, optionsOrLoose: Options = definedExternally): Int
external fun compareBuild(a: SemVer, b: String, optionsOrLoose: Boolean = definedExternally): Int
external fun compareBuild(a: SemVer, b: String, optionsOrLoose: Options = definedExternally): Int
external fun compareBuild(a: SemVer, b: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun compareBuild(a: SemVer, b: SemVer, optionsOrLoose: Options = definedExternally): Int

Compares two versions including build identifiers (the bit after + in the semantic version string).

Link copied to clipboard
external fun compareLoose(v1: String, v2: String): Int
external fun compareLoose(v1: String, v2: SemVer): Int
external fun compareLoose(v1: SemVer, v2: String): Int
external fun compareLoose(v1: SemVer, v2: SemVer): Int
Link copied to clipboard
external fun diff(v1: String, v2: String): ReleaseType?
external fun diff(v1: String, v2: SemVer): ReleaseType?
external fun diff(v1: SemVer, v2: String): ReleaseType?
external fun diff(v1: SemVer, v2: SemVer): ReleaseType?

Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same.

Link copied to clipboard
external fun eq(v1: String, v2: String): Boolean
external fun eq(v1: String, v2: SemVer): Boolean
external fun eq(v1: SemVer, v2: String): Boolean
external fun eq(v1: SemVer, v2: SemVer): Boolean
external fun eq(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun eq(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun eq(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun eq(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean
external fun eq(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun eq(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun eq(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun eq(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean

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.

Link copied to clipboard
external fun gt(v1: String, v2: String): Boolean
external fun gt(v1: String, v2: SemVer): Boolean
external fun gt(v1: SemVer, v2: String): Boolean
external fun gt(v1: SemVer, v2: SemVer): Boolean
external fun gt(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gt(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun gt(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gt(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean
external fun gt(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gt(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun gt(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gt(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean

v1 v2

Link copied to clipboard
external fun gte(v1: String, v2: String): Boolean
external fun gte(v1: String, v2: SemVer): Boolean
external fun gte(v1: SemVer, v2: String): Boolean
external fun gte(v1: SemVer, v2: SemVer): Boolean
external fun gte(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gte(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun gte(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gte(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean
external fun gte(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gte(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun gte(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gte(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean

v1 >= v2

Link copied to clipboard
external fun gtr(version: String, range: String): Boolean
external fun gtr(version: String, range: Range): Boolean
external fun gtr(version: SemVer, range: String): Boolean
external fun gtr(version: SemVer, range: Range): Boolean
external fun gtr(version: String, range: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gtr(version: String, range: String, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun gtr(version: String, range: Range, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gtr(version: String, range: Range, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun gtr(version: SemVer, range: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gtr(version: SemVer, range: String, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun gtr(version: SemVer, range: Range, optionsOrLoose: Boolean = definedExternally): Boolean
external fun gtr(version: SemVer, range: Range, optionsOrLoose: RangeOptions = definedExternally): Boolean

Return true if version is greater than all the versions possible in the range.

Link copied to clipboard
external fun inc(version: String, release: ReleaseType): String?
external fun inc(version: SemVer, release: ReleaseType): String?
external fun inc(version: String, release: ReleaseType, optionsOrLoose: Boolean = definedExternally, identifier: String = definedExternally): String?
external fun inc(version: String, release: ReleaseType, optionsOrLoose: Options = definedExternally, identifier: String = definedExternally): String?
external fun inc(version: SemVer, release: ReleaseType, optionsOrLoose: Boolean = definedExternally, identifier: String = definedExternally): String?
external fun inc(version: SemVer, release: ReleaseType, optionsOrLoose: Options = definedExternally, identifier: String = definedExternally): String?

Return the version incremented by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if it's not valid.

external fun inc(version: String, release: ReleaseType, identifier: String = definedExternally, identifierBase: Boolean = definedExternally): String?
external fun inc(version: String, release: ReleaseType, identifier: String = definedExternally, identifierBase: IdentifierBase = definedExternally): String?
external fun inc(version: SemVer, release: ReleaseType, identifier: String = definedExternally, identifierBase: Boolean = definedExternally): String?
external fun inc(version: SemVer, release: ReleaseType, identifier: String = definedExternally, identifierBase: IdentifierBase = definedExternally): String?
Link copied to clipboard
external fun intersects(range1: String, range2: String): Boolean
external fun intersects(range1: String, range2: Range): Boolean
external fun intersects(range1: Range, range2: String): Boolean
external fun intersects(range1: Range, range2: Range): Boolean
external fun intersects(range1: String, range2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun intersects(range1: String, range2: String, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun intersects(range1: String, range2: Range, optionsOrLoose: Boolean = definedExternally): Boolean
external fun intersects(range1: String, range2: Range, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun intersects(range1: Range, range2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun intersects(range1: Range, range2: String, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun intersects(range1: Range, range2: Range, optionsOrLoose: Boolean = definedExternally): Boolean
external fun intersects(range1: Range, range2: Range, optionsOrLoose: RangeOptions = definedExternally): Boolean

Return true if any of the ranges comparators intersect

Link copied to clipboard
external fun lt(v1: String, v2: String): Boolean
external fun lt(v1: String, v2: SemVer): Boolean
external fun lt(v1: SemVer, v2: String): Boolean
external fun lt(v1: SemVer, v2: SemVer): Boolean
external fun lt(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun lt(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun lt(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun lt(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean
external fun lt(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun lt(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun lt(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun lt(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean

v1 < v2

Link copied to clipboard
external fun lte(v1: String, v2: String): Boolean
external fun lte(v1: String, v2: SemVer): Boolean
external fun lte(v1: SemVer, v2: String): Boolean
external fun lte(v1: SemVer, v2: SemVer): Boolean
external fun lte(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun lte(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun lte(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun lte(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean
external fun lte(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun lte(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun lte(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun lte(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean

v1 <= v2

Link copied to clipboard
external fun ltr(version: String, range: String): Boolean
external fun ltr(version: String, range: Range): Boolean
external fun ltr(version: SemVer, range: String): Boolean
external fun ltr(version: SemVer, range: Range): Boolean
external fun ltr(version: String, range: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun ltr(version: String, range: String, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun ltr(version: String, range: Range, optionsOrLoose: Boolean = definedExternally): Boolean
external fun ltr(version: String, range: Range, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun ltr(version: SemVer, range: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun ltr(version: SemVer, range: String, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun ltr(version: SemVer, range: Range, optionsOrLoose: Boolean = definedExternally): Boolean
external fun ltr(version: SemVer, range: Range, optionsOrLoose: RangeOptions = definedExternally): Boolean

Return true if version is less than all the versions possible in the range.

Link copied to clipboard
external fun major(version: String): Int
external fun major(version: SemVer): Int
external fun major(version: String, optionsOrLoose: Boolean = definedExternally): Int
external fun major(version: String, optionsOrLoose: Options = definedExternally): Int
external fun major(version: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun major(version: SemVer, optionsOrLoose: Options = definedExternally): Int

Return the major version number.

Link copied to clipboard
external fun <T : Any> maxSatisfying(versions: ReadonlyArray<T>, range: String): T?
external fun <T : Any> maxSatisfying(versions: ReadonlyArray<T>, range: Range): T?
external fun <T : Any> maxSatisfying(versions: ReadonlyArray<T>, range: String, optionsOrLoose: Boolean = definedExternally): T?
external fun <T : Any> maxSatisfying(versions: ReadonlyArray<T>, range: String, optionsOrLoose: RangeOptions = definedExternally): T?
external fun <T : Any> maxSatisfying(versions: ReadonlyArray<T>, range: Range, optionsOrLoose: Boolean = definedExternally): T?
external fun <T : Any> maxSatisfying(versions: ReadonlyArray<T>, range: Range, optionsOrLoose: RangeOptions = definedExternally): T?

Return the highest version in the list that satisfies the range, or null if none of them do.

Link copied to clipboard
external fun minor(version: String): Int
external fun minor(version: SemVer): Int
external fun minor(version: String, optionsOrLoose: Boolean = definedExternally): Int
external fun minor(version: String, optionsOrLoose: Options = definedExternally): Int
external fun minor(version: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun minor(version: SemVer, optionsOrLoose: Options = definedExternally): Int

Return the minor version number.

Link copied to clipboard
external fun <T : Any> minSatisfying(versions: ReadonlyArray<T>, range: String): T?
external fun <T : Any> minSatisfying(versions: ReadonlyArray<T>, range: Range): T?
external fun <T : Any> minSatisfying(versions: ReadonlyArray<T>, range: String, optionsOrLoose: Boolean = definedExternally): T?
external fun <T : Any> minSatisfying(versions: ReadonlyArray<T>, range: String, optionsOrLoose: RangeOptions = definedExternally): T?
external fun <T : Any> minSatisfying(versions: ReadonlyArray<T>, range: Range, optionsOrLoose: Boolean = definedExternally): T?
external fun <T : Any> minSatisfying(versions: ReadonlyArray<T>, range: Range, optionsOrLoose: RangeOptions = definedExternally): T?

Return the lowest version in the list that satisfies the range, or null if none of them do.

Link copied to clipboard
external fun minVersion(range: String): SemVer?
external fun minVersion(range: Range): SemVer?
external fun minVersion(range: String, optionsOrLoose: Boolean = definedExternally): SemVer?
external fun minVersion(range: String, optionsOrLoose: Options = definedExternally): SemVer?
external fun minVersion(range: Range, optionsOrLoose: Boolean = definedExternally): SemVer?
external fun minVersion(range: Range, optionsOrLoose: Options = definedExternally): SemVer?

Return the lowest version that can possibly match the given range.

Link copied to clipboard
external fun neq(v1: String, v2: String): Boolean
external fun neq(v1: String, v2: SemVer): Boolean
external fun neq(v1: SemVer, v2: String): Boolean
external fun neq(v1: SemVer, v2: SemVer): Boolean
external fun neq(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun neq(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun neq(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun neq(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean
external fun neq(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun neq(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Boolean
external fun neq(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Boolean
external fun neq(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Boolean

v1 != v2 The opposite of eq.

Link copied to clipboard
external fun outside(version: String, range: String, hilo: OutsideHilo): Boolean
external fun outside(version: String, range: Range, hilo: OutsideHilo): Boolean
external fun outside(version: SemVer, range: String, hilo: OutsideHilo): Boolean
external fun outside(version: SemVer, range: Range, hilo: OutsideHilo): Boolean
external fun outside(version: String, range: String, hilo: OutsideHilo, optionsOrLoose: Boolean = definedExternally): Boolean
external fun outside(version: String, range: String, hilo: OutsideHilo, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun outside(version: String, range: Range, hilo: OutsideHilo, optionsOrLoose: Boolean = definedExternally): Boolean
external fun outside(version: String, range: Range, hilo: OutsideHilo, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun outside(version: SemVer, range: String, hilo: OutsideHilo, optionsOrLoose: Boolean = definedExternally): Boolean
external fun outside(version: SemVer, range: String, hilo: OutsideHilo, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun outside(version: SemVer, range: Range, hilo: OutsideHilo, optionsOrLoose: Boolean = definedExternally): Boolean
external fun outside(version: SemVer, range: Range, hilo: OutsideHilo, optionsOrLoose: RangeOptions = definedExternally): Boolean

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.)

Link copied to clipboard
external fun parse(version: String?): SemVer?
external fun parse(version: SemVer?): SemVer?
external fun parse(version: String?, optionsOrLoose: Boolean = definedExternally): SemVer?
external fun parse(version: String?, optionsOrLoose: Options = definedExternally): SemVer?
external fun parse(version: SemVer?, optionsOrLoose: Boolean = definedExternally): SemVer?
external fun parse(version: SemVer?, optionsOrLoose: Options = definedExternally): SemVer?

Return the parsed version as a SemVer object, or null if it's not valid.

Link copied to clipboard
external fun patch(version: String): Int
external fun patch(version: SemVer): Int
external fun patch(version: String, optionsOrLoose: Boolean = definedExternally): Int
external fun patch(version: String, optionsOrLoose: Options = definedExternally): Int
external fun patch(version: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun patch(version: SemVer, optionsOrLoose: Options = definedExternally): Int

Return the patch version number.

Link copied to clipboard
external fun prerelease(version: String): ReadonlyArray<Any>?
external fun prerelease(version: SemVer): ReadonlyArray<Any>?
external fun prerelease(version: String, optionsOrLoose: Boolean = definedExternally): ReadonlyArray<Any>?
external fun prerelease(version: String, optionsOrLoose: Options = definedExternally): ReadonlyArray<Any>?
external fun prerelease(version: SemVer, optionsOrLoose: Boolean = definedExternally): ReadonlyArray<Any>?
external fun prerelease(version: SemVer, optionsOrLoose: Options = definedExternally): ReadonlyArray<Any>?

Returns an array of prerelease components, or null if none exist.

Link copied to clipboard
external fun rcompare(v1: String, v2: String): Int
external fun rcompare(v1: String, v2: SemVer): Int
external fun rcompare(v1: SemVer, v2: String): Int
external fun rcompare(v1: SemVer, v2: SemVer): Int
external fun rcompare(v1: String, v2: String, optionsOrLoose: Boolean = definedExternally): Int
external fun rcompare(v1: String, v2: String, optionsOrLoose: Options = definedExternally): Int
external fun rcompare(v1: String, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun rcompare(v1: String, v2: SemVer, optionsOrLoose: Options = definedExternally): Int
external fun rcompare(v1: SemVer, v2: String, optionsOrLoose: Boolean = definedExternally): Int
external fun rcompare(v1: SemVer, v2: String, optionsOrLoose: Options = definedExternally): Int
external fun rcompare(v1: SemVer, v2: SemVer, optionsOrLoose: Boolean = definedExternally): Int
external fun rcompare(v1: SemVer, v2: SemVer, optionsOrLoose: Options = definedExternally): Int

The reverse of compare.

Link copied to clipboard
external fun <T : Any> rsort(list: ReadonlyArray<T>): ReadonlyArray<T>
external fun <T : Any> rsort(list: ReadonlyArray<T>, optionsOrLoose: Boolean = definedExternally): ReadonlyArray<T>
external fun <T : Any> rsort(list: ReadonlyArray<T>, optionsOrLoose: Options = definedExternally): ReadonlyArray<T>

Sorts an array of semver entries in descending order using compareBuild().

Link copied to clipboard
external fun satisfies(version: String, range: String): Boolean
external fun satisfies(version: String, range: Range): Boolean
external fun satisfies(version: SemVer, range: String): Boolean
external fun satisfies(version: SemVer, range: Range): Boolean
external fun satisfies(version: String, range: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun satisfies(version: String, range: String, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun satisfies(version: String, range: Range, optionsOrLoose: Boolean = definedExternally): Boolean
external fun satisfies(version: String, range: Range, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun satisfies(version: SemVer, range: String, optionsOrLoose: Boolean = definedExternally): Boolean
external fun satisfies(version: SemVer, range: String, optionsOrLoose: RangeOptions = definedExternally): Boolean
external fun satisfies(version: SemVer, range: Range, optionsOrLoose: Boolean = definedExternally): Boolean
external fun satisfies(version: SemVer, range: Range, optionsOrLoose: RangeOptions = definedExternally): Boolean

Return true if the version satisfies the range.

Link copied to clipboard
external fun simplify(ranges: ReadonlyArray<String>, range: String, options: Options = definedExternally): Any
external fun simplify(ranges: ReadonlyArray<String>, range: Range, options: Options = definedExternally): Any

Return a "simplified" range that matches the same items in versions list as the range specified. Note that it does not guarantee that it would match the same versions in all cases, only for the set of versions provided. This is useful when generating ranges by joining together multiple versions with || programmatically, to provide the user with something a bit more ergonomic. If the provided range is shorter in string-length than the generated range, then that is returned.

Link copied to clipboard
external fun <T : Any> sort(list: ReadonlyArray<T>): ReadonlyArray<T>
external fun <T : Any> sort(list: ReadonlyArray<T>, optionsOrLoose: Boolean = definedExternally): ReadonlyArray<T>
external fun <T : Any> sort(list: ReadonlyArray<T>, optionsOrLoose: Options = definedExternally): ReadonlyArray<T>

Sorts an array of semver entries in ascending order using compareBuild().

Link copied to clipboard
external fun subset(sub: String, dom: String, options: RangeOptions = definedExternally): Boolean
external fun subset(sub: String, dom: Range, options: RangeOptions = definedExternally): Boolean
external fun subset(sub: Range, dom: String, options: RangeOptions = definedExternally): Boolean
external fun subset(sub: Range, dom: Range, options: RangeOptions = definedExternally): Boolean

Return true if the subRange range is entirely contained by the superRange range.

Link copied to clipboard
external fun toComparators(range: String, optionsOrLoose: Boolean = definedExternally): ReadonlyArray<ReadonlyArray<String>>
external fun toComparators(range: String, optionsOrLoose: Options = definedExternally): ReadonlyArray<ReadonlyArray<String>>
external fun toComparators(range: Range, optionsOrLoose: Boolean = definedExternally): ReadonlyArray<ReadonlyArray<String>>
external fun toComparators(range: Range, optionsOrLoose: Options = definedExternally): ReadonlyArray<ReadonlyArray<String>>

Mostly just for testing and legacy API reasons

Link copied to clipboard
external fun valid(version: String?): String?
external fun valid(version: SemVer?): String?
external fun valid(version: String?, optionsOrLoose: Boolean = definedExternally): String?
external fun valid(version: String?, optionsOrLoose: Options = definedExternally): String?
external fun valid(version: SemVer?, optionsOrLoose: Boolean = definedExternally): String?
external fun valid(version: SemVer?, optionsOrLoose: Options = definedExternally): String?

Return the parsed version as a string, or null if it's not valid.

Link copied to clipboard
external fun validRange(range: String?): String?
external fun validRange(range: Range?): String?
external fun validRange(range: String?, optionsOrLoose: Boolean = definedExternally): String?
external fun validRange(range: String?, optionsOrLoose: RangeOptions = definedExternally): String?
external fun validRange(range: Range?, optionsOrLoose: Boolean = definedExternally): String?
external fun validRange(range: Range?, optionsOrLoose: RangeOptions = definedExternally): String?

Return the valid range or null if it's not valid