UNPKG

hd-utils

Version:

A handy utils for modern JS developers

32 lines (31 loc) 1.19 kB
/** * @description Class Definition: SemverLite is defined to handle version strings. * This is just a very lite semver implementation, if you need the actual thing you can check https://www.npmjs.com/package/semver */ export default class SemverLite { private static readonly versionRegex; /** * @description Compares two versions and returns true if version1 is greater than version2. */ static greaterThan(version1: string, version2: string): boolean; /** * @description Compares two versions and returns true if version1 is less than version2. */ static lessThan(version1: string, version2: string): boolean; /** * @description Checks if a version string is valid. */ static isValid(version: string): boolean; /** * @description Extracts the numeric version part from a string. */ static coerce(version: string): string; /** * @description Returns the smallest version from an array of versions. */ static minVersion(versions: string[]): string; /** * @description Converts a version string into a comparable numeric value. */ static parse(version: string): number; }