|
| 1 | +diff --git a/lib/esm/satisfies.js b/lib/esm/satisfies.js |
| 2 | +index 7586b71657332f855431c4dd4f05e9394fd9aac3..a6ec29bfc98907c67ed4af71fca73bd8bff88798 100644 |
| 3 | +--- a/lib/esm/satisfies.js |
| 4 | ++++ b/lib/esm/satisfies.js |
| 5 | +@@ -40,8 +40,9 @@ export const satisfies = (version, range) => { |
| 6 | + // else range of either "~" or "^" is assumed |
| 7 | + const [v1, v2, v3, , vp] = validateAndParse(version); |
| 8 | + const [r1, r2, r3, , rp] = validateAndParse(range); |
| 9 | +- const v = [v1, v2, v3]; |
| 10 | ++ const v = [v1, v2 !== null && v2 !== void 0 ? v2 : 'x', v3 !== null && v3 !== void 0 ? v3 : 'x']; |
| 11 | + const r = [r1, r2 !== null && r2 !== void 0 ? r2 : 'x', r3 !== null && r3 !== void 0 ? r3 : 'x']; |
| 12 | ++ |
| 13 | + // validate pre-release |
| 14 | + if (rp) { |
| 15 | + if (!vp) |
| 16 | +diff --git a/lib/esm/utils.js b/lib/esm/utils.js |
| 17 | +index b5cc8b9927ab38fc67032c133b531e95ec4cec15..ec56105fd2d806aa922f1488a27b02c56aff1865 100644 |
| 18 | +--- a/lib/esm/utils.js |
| 19 | ++++ b/lib/esm/utils.js |
| 20 | +@@ -28,7 +28,7 @@ const compareStrings = (a, b) => { |
| 21 | + }; |
| 22 | + export const compareSegments = (a, b) => { |
| 23 | + for (let i = 0; i < Math.max(a.length, b.length); i++) { |
| 24 | +- const r = compareStrings(a[i] || '0', b[i] || '0'); |
| 25 | ++ const r = compareStrings(a[i] || 'x', b[i] || 'x'); |
| 26 | + if (r !== 0) |
| 27 | + return r; |
| 28 | + } |
| 29 | +diff --git a/lib/umd/index.js b/lib/umd/index.js |
| 30 | +index 2cfef261bca520e21ed41fc14950732b8aa6339b..1059784db86635f3aaaba83b5a72c5015e1d8490 100644 |
| 31 | +--- a/lib/umd/index.js |
| 32 | ++++ b/lib/umd/index.js |
| 33 | +@@ -152,7 +152,7 @@ |
| 34 | + // else range of either "~" or "^" is assumed |
| 35 | + const [v1, v2, v3, , vp] = validateAndParse(version); |
| 36 | + const [r1, r2, r3, , rp] = validateAndParse(range); |
| 37 | +- const v = [v1, v2, v3]; |
| 38 | ++ const v = [v1, v2 !== null && v2 !== void 0 ? v2 : 'x', v3 !== null && v3 !== void 0 ? v3 : 'x']; |
| 39 | + const r = [r1, r2 !== null && r2 !== void 0 ? r2 : 'x', r3 !== null && r3 !== void 0 ? r3 : 'x']; |
| 40 | + // validate pre-release |
| 41 | + if (rp) { |
| 42 | +diff --git a/package.json b/package.json |
| 43 | +index b05b3daf706d7ba4e594233f8791fc3007a8e2cd..e51e76b86f95e9ebf0b5dba3b82aeb119628528d 100644 |
| 44 | +--- a/package.json |
| 45 | ++++ b/package.json |
| 46 | +@@ -26,7 +26,7 @@ |
| 47 | + "prepublishOnly": "npm run build", |
| 48 | + "test": "c8 --reporter=lcov mocha" |
| 49 | + }, |
| 50 | +- "main": "./lib/umd/index.js", |
| 51 | ++ "main": "./lib/src/index.ts", |
| 52 | + "module": "./lib/esm/index.js", |
| 53 | + "types": "./lib/esm/index.d.ts", |
| 54 | + "sideEffects": false, |
| 55 | +diff --git a/src/satisfies.ts b/src/satisfies.ts |
| 56 | +index 66cb171d7f32e68fdda6929d2da223b97a053737..6b4973f037843f264338a01efdc4ace5dcf042cd 100644 |
| 57 | +--- a/src/satisfies.ts |
| 58 | ++++ b/src/satisfies.ts |
| 59 | +@@ -43,7 +43,7 @@ export const satisfies = (version: string, range: string): boolean => { |
| 60 | + // else range of either "~" or "^" is assumed |
| 61 | + const [v1, v2, v3, , vp] = validateAndParse(version); |
| 62 | + const [r1, r2, r3, , rp] = validateAndParse(range); |
| 63 | +- const v = [v1, v2, v3]; |
| 64 | ++ const v = [v1, v2 ?? 'x', v3 ?? 'x']; |
| 65 | + const r = [r1, r2 ?? 'x', r3 ?? 'x']; |
| 66 | + |
| 67 | + // validate pre-release |
0 commit comments