compare-versions
Advanced tools
Comparing version 6.0.0-rc.1 to 6.0.0-rc.2
@@ -26,3 +26,3 @@ /** | ||
*/ | ||
export type CompareOperator = '>' | '>=' | '=' | '<' | '<='; | ||
export type CompareOperator = '>' | '>=' | '=' | '<' | '<=' | '!='; | ||
/** | ||
@@ -29,0 +29,0 @@ * Compare [semver](https://semver.org/) version strings using the specified operator. |
@@ -85,2 +85,6 @@ /** | ||
} | ||
else if (range.includes(' - ')) { | ||
const [a, b] = range.split(' - ', 2); | ||
return satisfies(version, `>=${a} <=${b}`); | ||
} | ||
else if (range.includes(' ')) { | ||
@@ -167,2 +171,3 @@ return range | ||
'<': [-1], | ||
'!=': [-1, 1], | ||
}; | ||
@@ -169,0 +174,0 @@ const allowedOperators = Object.keys(operatorResMap); |
@@ -91,2 +91,6 @@ (function (global, factory) { | ||
} | ||
else if (range.includes(' - ')) { | ||
const [a, b] = range.split(' - ', 2); | ||
return satisfies(version, `>=${a} <=${b}`); | ||
} | ||
else if (range.includes(' ')) { | ||
@@ -173,2 +177,3 @@ return range | ||
'<': [-1], | ||
'!=': [-1, 1], | ||
}; | ||
@@ -175,0 +180,0 @@ const allowedOperators = Object.keys(operatorResMap); |
{ | ||
"name": "compare-versions", | ||
"version": "6.0.0-rc.1", | ||
"version": "6.0.0-rc.2", | ||
"description": "Compare semver version strings to find greater, equal or lesser.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -15,2 +15,3 @@ # compare-versions | ||
- Leading zero is ignored, e.g. `1.01.1` is interpreted as `1.1.1`. | ||
- [npm version ranges](https://docs.npmjs.com/cli/v6/using-npm/semver#ranges), e.g. `1.2.7 || >=1.2.9 <2.0.0` | ||
@@ -87,2 +88,6 @@ ## Install | ||
satisfies('10.1.1', '>=10.2.2'); // false | ||
satisfies('1.4.6', '1.2.7 || >=1.2.9 <2.0.0'); // true | ||
satisfies('1.2.8', '1.2.7 || >=1.2.9 <2.0.0'); // false | ||
satisfies('1.5.1', '1.2.3 - 2.3.4'); // true | ||
satisfies('2.3.5', '1.2.3 - 2.3.4'); // false | ||
``` | ||
@@ -89,0 +94,0 @@ |
@@ -50,3 +50,3 @@ /** | ||
*/ | ||
export type CompareOperator = '>' | '>=' | '=' | '<' | '<='; | ||
export type CompareOperator = '>' | '>=' | '=' | '<' | '<=' | '!='; | ||
@@ -98,2 +98,5 @@ /** | ||
return range.split('||').some((r) => satisfies(version, r)); | ||
} else if (range.includes(' - ')) { | ||
const [a, b] = range.split(' - ', 2); | ||
return satisfies(version, `>=${a} <=${b}`); | ||
} else if (range.includes(' ')) { | ||
@@ -195,2 +198,3 @@ return range | ||
'<': [-1], | ||
'!=': [-1, 1], | ||
}; | ||
@@ -197,0 +201,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62939
24
855
119