UNPKG

@btfuse/core

Version:

A native-first framework for building hybdrid web-native applications

63 lines (62 loc) 1.86 kB
/** * A class that represents a {@link https://semver.org/} versioning. */ export declare class Version { private $major; private $minor; private $patch?; static readonly LESS_THAN: number; static readonly EQUAL: number; static readonly GREATER_THAN: number; constructor(major: number, minor?: number, patch?: number); /** * @remarks * Parses a semver-formatted version string and creates a Version object. * Does not support pre-release labels, which will be chopped off. * If any dot notation segment is missing or is not parseable as an integer, * it will default to 0. * * @param version - Semver formatted version string * @returns A version object */ static parseVersionString(version: string): Version; /** * @sealed * @returns The major component of this version */ getMajor(): number; /** * @sealed * @returns The minor component of this version */ getMinor(): number; /** * @sealed * @returns The patch component of this version */ getPatch(): number; /** * @sealed * @returns A semver-formatted string */ toString(): string; /** * @sealed * @param b - The right side version * @remarks * This is the equivilant in using `Version.compare(this, b)`. * See {@link copmare} for more details. */ compare(b: Version): number; /** * @remarks * Compares this version with another. If left side is greater than right side, * {@link GREATER_THAN} is returned. If they are equal, {@link EQUAL} is returned. * Otherwise, {@link LESS_THAN} is returned. * * @param lhs - The left side version * @param rhs - The right side version * @returns */ static compare(lhs: Version, rhs: Version): number; }