compare-versions
Advanced tools
Comparing version 5.0.3 to 6.0.0-rc.1
@@ -81,2 +81,13 @@ /** | ||
export const satisfies = (version, range) => { | ||
// handle multiple comparators | ||
if (range.includes('||')) { | ||
return range.split('||').some((r) => satisfies(version, r)); | ||
} | ||
else if (range.includes(' ')) { | ||
return range | ||
.trim() | ||
.replace(/\s{2,}/g, ' ') | ||
.split(' ') | ||
.every((r) => satisfies(version, r)); | ||
} | ||
// if no range operator then "=" | ||
@@ -83,0 +94,0 @@ const m = range.match(/^([<>=~^]+)/); |
@@ -87,2 +87,13 @@ (function (global, factory) { | ||
const satisfies = (version, range) => { | ||
// handle multiple comparators | ||
if (range.includes('||')) { | ||
return range.split('||').some((r) => satisfies(version, r)); | ||
} | ||
else if (range.includes(' ')) { | ||
return range | ||
.trim() | ||
.replace(/\s{2,}/g, ' ') | ||
.split(' ') | ||
.every((r) => satisfies(version, r)); | ||
} | ||
// if no range operator then "=" | ||
@@ -89,0 +100,0 @@ const m = range.match(/^([<>=~^]+)/); |
{ | ||
"name": "compare-versions", | ||
"version": "5.0.3", | ||
"version": "6.0.0-rc.1", | ||
"description": "Compare semver version strings to find greater, equal or lesser.", | ||
@@ -26,2 +26,3 @@ "repository": { | ||
"build:umd": "rollup lib/esm/index.js --format umd --name compareVersions --sourcemap -o lib/umd/index.js", | ||
"prepublishOnly": "npm run build", | ||
"test": "c8 --reporter=lcov mocha -r ts-node/register test/**/*.ts" | ||
@@ -28,0 +29,0 @@ }, |
@@ -93,3 +93,14 @@ /** | ||
*/ | ||
export const satisfies = (version: string, range: string) => { | ||
export const satisfies = (version: string, range: string): boolean => { | ||
// handle multiple comparators | ||
if (range.includes('||')) { | ||
return range.split('||').some((r) => satisfies(version, r)); | ||
} else if (range.includes(' ')) { | ||
return range | ||
.trim() | ||
.replace(/\s{2,}/g, ' ') | ||
.split(' ') | ||
.every((r) => satisfies(version, r)); | ||
} | ||
// if no range operator then "=" | ||
@@ -96,0 +107,0 @@ const m = range.match(/^([<>=~^]+)/); |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
45962
598
1