20 lines
788 B
TypeScript
20 lines
788 B
TypeScript
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;
|