All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.lib.esm.compare.d.ts Maven / Gradle / Ivy

The newest version!
import { CompareOperator } from './utils.js';
/**
 * Compare [semver](https://semver.org/) version strings using the specified operator.
 *
 * @param v1 First version to compare
 * @param v2 Second version to compare
 * @param operator Allowed arithmetic operator to use
 * @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
 *
 * @example
 * ```
 * compare('10.1.8', '10.0.4', '>'); // return true
 * compare('10.0.1', '10.0.1', '='); // return true
 * compare('10.1.1', '10.2.2', '<'); // return true
 * compare('10.1.1', '10.2.2', '<='); // return true
 * compare('10.1.1', '10.2.2', '>='); // return false
 * ```
 */
export declare const compare: (v1: string, v2: string, operator: CompareOperator) => boolean;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy