import { SemVer, Range, Comparator } from '../models'; /** * Compares two semantic versions. * * @param a - First version * @param b - Second version * @returns -1 if a < b, 0 if a == b, 1 if a > b * * @example Compare two semantic versions * compare(parseVersion('1.0.0'), parseVersion('2.0.0')) // -1 * compare(parseVersion('1.0.0'), parseVersion('1.0.0')) // 0 * compare(parseVersion('2.0.0'), parseVersion('1.0.0')) // 1 */ declare function compare(a: SemVer, b: SemVer): -1 | 0 | 1; /** * Checks if two versions are equal (ignoring build metadata). * * @param a - First version * @param b - Second version * @returns True if versions are equal * * @example Check if two versions are equal * ```typescript * eq(parseVersionStrict('1.0.0'), parseVersionStrict('1.0.0')) // => true * eq(parseVersionStrict('1.0.0'), parseVersionStrict('1.0.1')) // => false * ``` */ declare function eq(a: SemVer, b: SemVer): boolean; /** * Checks if a < b. * * @param a - First version to compare * @param b - Second version to compare * @returns True if a is less than b * * @example Check if version a is less than b * ```typescript * lt(parseVersionStrict('1.0.0'), parseVersionStrict('2.0.0')) // => true * lt(parseVersionStrict('2.0.0'), parseVersionStrict('1.0.0')) // => false * ``` */ declare function lt(a: SemVer, b: SemVer): boolean; /** * Checks if a <= b. * * @param a - First version to compare * @param b - Second version to compare * @returns True if a is less than or equal to b * * @example Check if version a is less than or equal to b * ```typescript * lte(parseVersionStrict('1.0.0'), parseVersionStrict('1.0.0')) // => true * lte(parseVersionStrict('1.0.0'), parseVersionStrict('2.0.0')) // => true * ``` */ declare function lte(a: SemVer, b: SemVer): boolean; /** * Checks if a > b. * * @param a - First version to compare * @param b - Second version to compare * @returns True if a is greater than b * * @example Check if version a is greater than b * ```typescript * gt(parseVersionStrict('2.0.0'), parseVersionStrict('1.0.0')) // => true * gt(parseVersionStrict('1.0.0'), parseVersionStrict('2.0.0')) // => false * ``` */ declare function gt(a: SemVer, b: SemVer): boolean; /** * Checks if a >= b. * * @param a - First version to compare * @param b - Second version to compare * @returns True if a is greater than or equal to b * * @example Check if version a is greater than or equal to b * ```typescript * gte(parseVersionStrict('2.0.0'), parseVersionStrict('1.0.0')) // => true * gte(parseVersionStrict('1.0.0'), parseVersionStrict('1.0.0')) // => true * ``` */ declare function gte(a: SemVer, b: SemVer): boolean; /** * Checks if a != b. * * @param a - First version to compare * @param b - Second version to compare * @returns True if versions are not equal * * @example Check if two versions are not equal * ```typescript * neq(parseVersionStrict('1.0.0'), parseVersionStrict('2.0.0')) // => true * neq(parseVersionStrict('1.0.0'), parseVersionStrict('1.0.0')) // => false * ``` */ declare function neq(a: SemVer, b: SemVer): boolean; /** * Checks if a version satisfies a comparator. * * @param version - Version to check * @param comparator - Comparator to test against * @returns True if version satisfies the comparator * * @example Check if version satisfies a comparator * ```typescript * const gte100 = createComparator('>=', parseVersionStrict('1.0.0')) * satisfiesComparator(parseVersionStrict('2.0.0'), gte100) // => true * satisfiesComparator(parseVersionStrict('0.9.0'), gte100) // => false * ``` */ declare function satisfiesComparator(version: SemVer, comparator: Comparator): boolean; /** * Checks if a version satisfies a range. * * @param version - Version to check * @param range - Range to test against * @returns True if version satisfies the range * * @example Check if version satisfies a range * satisfies(parseVersion('1.2.3'), parseRange('^1.0.0')) // true * satisfies(parseVersion('2.0.0'), parseRange('^1.0.0')) // false */ declare function satisfies(version: SemVer, range: Range): boolean; /** * Finds the maximum version that satisfies a range. * * @param versions - Array of versions to check * @param range - Range to test against * @returns The maximum satisfying version, or null if none satisfy * * @example Find the maximum version satisfying a range * ```typescript * const versions = ['1.0.0', '1.5.0', '2.0.0'].map(parseVersionStrict) * maxSatisfying(versions, parseRangeStrict('^1.0.0')) * // => { major: 1, minor: 5, patch: 0, ... } * ``` */ declare function maxSatisfying(versions: readonly SemVer[], range: Range): SemVer | null; /** * Finds the minimum version that satisfies a range. * * @param versions - Array of versions to check * @param range - Range to test against * @returns The minimum satisfying version, or null if none satisfy * * @example Find the minimum version satisfying a range * ```typescript * const versions = ['1.0.0', '1.5.0', '2.0.0'].map(parseVersionStrict) * minSatisfying(versions, parseRangeStrict('^1.0.0')) * // => { major: 1, minor: 0, patch: 0, ... } * ``` */ declare function minSatisfying(versions: readonly SemVer[], range: Range): SemVer | null; /** * Sorts an array of versions in ascending order. * * @param versions - Array of versions to sort * @returns A new sorted array * * @example Sort versions in ascending order * sort([v2, v1, v3]) // [v1, v2, v3] */ declare function sort(versions: readonly SemVer[]): SemVer[]; /** * Sorts an array of versions in descending order. * * @param versions - Array of versions to sort * @returns A new sorted array * * @example Sort versions in descending order * sortDescending([v1, v3, v2]) // [v3, v2, v1] */ declare function sortDescending(versions: readonly SemVer[]): SemVer[]; /** * Returns the maximum version from an array. * * @param versions - Array of versions * @returns The maximum version, or null if array is empty * * @example Get the maximum version from an array * ```typescript * const versions = [parseVersionStrict('1.0.0'), parseVersionStrict('2.0.0')] * max(versions) // => { major: 2, minor: 0, patch: 0, ... } * max([]) // => null * ``` */ declare function max(versions: readonly SemVer[]): SemVer | null; /** * Returns the minimum version from an array. * * @param versions - Array of versions * @returns The minimum version, or null if array is empty * * @example Get the minimum version from an array * ```typescript * const versions = [parseVersionStrict('1.0.0'), parseVersionStrict('2.0.0')] * min(versions) // => { major: 1, minor: 0, patch: 0, ... } * min([]) // => null * ``` */ declare function min(versions: readonly SemVer[]): SemVer | null; export { compare, eq, gt, gte, lt, lte, max, maxSatisfying, min, minSatisfying, neq, satisfies, satisfiesComparator, sort, sortDescending };