@snyk/ruby-semver
Advanced tools
Comparing version 2.2.2 to 3.0.0
{ | ||
"name": "@snyk/ruby-semver", | ||
"description": "node-semver compatible API with RubyGems semantics", | ||
"main": "index.js", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"compile-ruby": "scripts/compile-ruby", | ||
"format": "prettier --write 'lib/**/*.?s' 'test/**/*.?s'", | ||
"prepare": "npm run build", | ||
"build": "tsc", | ||
"lint": "eslint 'lib/**/*.?s'", | ||
"test": "ava --verbose" | ||
@@ -12,3 +17,10 @@ }, | ||
"devDependencies": { | ||
"ava": "^0.25.0" | ||
"@ava/babel": "^1.0.1", | ||
"@typescript-eslint/eslint-plugin": "^3.5.0", | ||
"@typescript-eslint/parser": "^3.5.0", | ||
"ava": "^3.9.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"prettier": "^2.0.5", | ||
"typescript": "~3.8.3" | ||
}, | ||
@@ -22,8 +34,12 @@ "repository": { | ||
}, | ||
"ava": { | ||
"babel": true | ||
}, | ||
"dependencies": { | ||
"lodash.escaperegexp": "^4.1.0", | ||
"lodash.flatten": "^4.4.0", | ||
"lodash.uniq": "^4.5.0" | ||
"lodash.uniq": "^4.5.0", | ||
"tslib": "^1.13.0" | ||
}, | ||
"version": "2.2.2" | ||
"version": "3.0.0" | ||
} |
@@ -10,3 +10,3 @@ import test from 'ava'; | ||
test('cmp(v1, ">", v2)', t => { | ||
test('cmp(v1, ">", v2)', (t) => { | ||
t.truthy(cmp('2', '>', '1')); | ||
@@ -17,3 +17,3 @@ t.falsy(cmp('2', '>', '2')); | ||
test('cmp(v1, ">=", v2)', t => { | ||
test('cmp(v1, ">=", v2)', (t) => { | ||
t.truthy(cmp('2', '>=', '1')); | ||
@@ -24,3 +24,3 @@ t.truthy(cmp('2', '>=', '2')); | ||
test('cmp(v1, "<", v2)', t => { | ||
test('cmp(v1, "<", v2)', (t) => { | ||
t.truthy(cmp('1', '<', '2')); | ||
@@ -31,3 +31,3 @@ t.falsy(cmp('2', '<', '2')); | ||
test('cmp(v1, "<=", v2)', t => { | ||
test('cmp(v1, "<=", v2)', (t) => { | ||
t.truthy(cmp('1', '<=', '2')); | ||
@@ -38,3 +38,3 @@ t.truthy(cmp('2', '<=', '2')); | ||
test('cmp(v1, "==", v2)', t => { | ||
test('cmp(v1, "==", v2)', (t) => { | ||
t.truthy(cmp('2', '==', '2')); | ||
@@ -45,3 +45,3 @@ t.truthy(cmp('2', '==', '2.0')); | ||
test('cmp(v1, "!=", v2)', t => { | ||
test('cmp(v1, "!=", v2)', (t) => { | ||
t.truthy(cmp('2', '!=', '1')); | ||
@@ -52,3 +52,3 @@ t.falsy(cmp('2', '!=', '2')); | ||
test('cmp(v1, "===", v2)', t => { | ||
test('cmp(v1, "===", v2)', (t) => { | ||
t.truthy(cmp('2', '===', '2')); | ||
@@ -59,3 +59,3 @@ t.falsy(cmp('2', '===', '1')); | ||
test('cmp(v1, "!==", v2)', t => { | ||
test('cmp(v1, "!==", v2)', (t) => { | ||
t.falsy(cmp('2', '!==', '2')); | ||
@@ -66,6 +66,12 @@ t.truthy(cmp('2', '!==', '2.0')); | ||
test('cmp(v1, "nonsense", v2)', t => { | ||
t.throws(() => cmp('2', 'nonsense', '2'), 'Invalid comparator: nonsense'); | ||
t.throws(() => cmp('2', '!====', '2'), 'Invalid comparator: !===='); | ||
t.throws(() => cmp('2', '>broken', '2'), 'Invalid comparator: >broken'); | ||
test('cmp(v1, "nonsense", v2)', (t) => { | ||
t.throws(() => cmp('2', 'nonsense', '2'), { | ||
message: 'Invalid comparator: nonsense', | ||
}); | ||
t.throws(() => cmp('2', '!====', '2'), { | ||
message: 'Invalid comparator: !====', | ||
}); | ||
t.throws(() => cmp('2', '>broken', '2'), { | ||
message: 'Invalid comparator: >broken', | ||
}); | ||
}); |
@@ -8,3 +8,3 @@ import test from 'ava'; | ||
test('compare(v1, v2): 0 if v1 == v2', t => { | ||
test('compare(v1, v2): 0 if v1 == v2', (t) => { | ||
t.is(compare('1', '1'), 0); | ||
@@ -18,3 +18,3 @@ t.is(compare('1.1', '1.1'), 0); | ||
test('compare(v1, v2): 1 if v1 > v2', t => { | ||
test('compare(v1, v2): 1 if v1 > v2', (t) => { | ||
t.is(compare('2', '1'), 1); | ||
@@ -28,3 +28,3 @@ t.is(compare('1.2', '1.1'), 1); | ||
test('compare(v1, v2): -1 if v1 < v2', t => { | ||
test('compare(v1, v2): -1 if v1 < v2', (t) => { | ||
t.is(compare('1', '2'), -1); | ||
@@ -31,0 +31,0 @@ t.is(compare('1.1', '1.2'), -1); |
@@ -12,3 +12,3 @@ import test from 'ava'; | ||
test('diff(v1, v2): same versions', t => { | ||
test('diff(v1, v2): same versions', (t) => { | ||
t.is(diff('1', '1'), null); | ||
@@ -29,3 +29,3 @@ t.is(diff('1.1', '1.1'), null); | ||
test('diff(v1, v2): major versions', t => { | ||
test('diff(v1, v2): major versions', (t) => { | ||
t.is(diff('1', '3'), 'major'); | ||
@@ -38,3 +38,3 @@ t.is(diff('1.1', '3.1'), 'major'); | ||
test('diff(v1, v2): minor versions', t => { | ||
test('diff(v1, v2): minor versions', (t) => { | ||
t.is(diff('1.1', '1.2'), 'minor'); | ||
@@ -47,3 +47,3 @@ t.is(diff('1.1.2', '1.2.1.1'), 'minor'); | ||
test('diff(v1, v2): patch versions', t => { | ||
test('diff(v1, v2): patch versions', (t) => { | ||
t.is(diff('1.1.2', '1.1.3'), 'patch'); | ||
@@ -57,11 +57,11 @@ t.is(diff('1.1.2', '1.1.2.1'), 'patch'); | ||
test('diff(v1, v2): premajor versions', t => { | ||
test('diff(v1, v2): premajor versions', (t) => { | ||
t.is(diff('1.0.0.alpha.1', '2.0.0'), 'premajor'); | ||
}); | ||
test('diff(v1, v2): preminor versions', t => { | ||
test('diff(v1, v2): preminor versions', (t) => { | ||
t.is(diff('1.1.2.alpha.1', '1.2.0'), 'preminor'); | ||
}); | ||
test('diff(v1, v2): prepatch versions', t => { | ||
test('diff(v1, v2): prepatch versions', (t) => { | ||
t.is(diff('1.1.2.alpha.1', '1.1.3'), 'prepatch'); | ||
@@ -73,3 +73,3 @@ t.is(diff('1.1.2.3.alpha.1', '1.1.2.alpha.2'), 'prepatch'); | ||
test('diff(v1, v2): prerelease versions', t => { | ||
test('diff(v1, v2): prerelease versions', (t) => { | ||
t.is(diff('1.1.2.alpha.1', '1.1.2.alpha.2'), 'prerelease'); | ||
@@ -76,0 +76,0 @@ t.is(diff('1.1.2.3.alpha.1', '1.1.2.3.alpha.2'), 'prerelease'); |
@@ -5,3 +5,3 @@ import test from 'ava'; | ||
test('eq(v1, v2): v1 == v2', t => { | ||
test('eq(v1, v2): v1 == v2', (t) => { | ||
t.truthy(eq('2', '2')); | ||
@@ -8,0 +8,0 @@ t.truthy(eq('2', '2.0')); |
@@ -5,3 +5,3 @@ import test from 'ava'; | ||
test('gt(v1, v2): v1 > v2', t => { | ||
test('gt(v1, v2): v1 > v2', (t) => { | ||
t.truthy(gt('2', '1')); | ||
@@ -8,0 +8,0 @@ t.truthy(gt('5.4', '5.3')); |
@@ -5,3 +5,3 @@ import test from 'ava'; | ||
test('gte(v1, v2): v1 >= v2', t => { | ||
test('gte(v1, v2): v1 >= v2', (t) => { | ||
t.truthy(gte('2', '1')); | ||
@@ -8,0 +8,0 @@ t.truthy(gte('5.4', '5.3')); |
@@ -5,3 +5,3 @@ import test from 'ava'; | ||
test('lt(v1, v2): v1 < v2', t => { | ||
test('lt(v1, v2): v1 < v2', (t) => { | ||
t.truthy(lt('1', '2')); | ||
@@ -8,0 +8,0 @@ t.truthy(lt('5.3', '5.4')); |
@@ -5,3 +5,3 @@ import test from 'ava'; | ||
test('lte(v1, v2): v1 <= v2', t => { | ||
test('lte(v1, v2): v1 <= v2', (t) => { | ||
t.truthy(lte('1', '2')); | ||
@@ -8,0 +8,0 @@ t.truthy(lte('5.3', '5.4')); |
@@ -5,3 +5,3 @@ import test from 'ava'; | ||
test('neq(v1, v2): v1 != v2', t => { | ||
test('neq(v1, v2): v1 != v2', (t) => { | ||
t.truthy(neq('2', '1')); | ||
@@ -8,0 +8,0 @@ t.truthy(neq('5.4', '5.3')); |
@@ -8,3 +8,3 @@ import test from 'ava'; | ||
test('rcompare(v1, v2): 0 if v1 == v2', t => { | ||
test('rcompare(v1, v2): 0 if v1 == v2', (t) => { | ||
t.is(rcompare('1', '1'), 0); | ||
@@ -18,3 +18,3 @@ t.is(rcompare('1.1', '1.1'), 0); | ||
test('rcompare(v1, v2): -1 if v1 > v2', t => { | ||
test('rcompare(v1, v2): -1 if v1 > v2', (t) => { | ||
t.is(rcompare('2', '1'), -1); | ||
@@ -28,3 +28,3 @@ t.is(rcompare('1.2', '1.1'), -1); | ||
test('rcompare(v1, v2): 1 if v1 < v2', t => { | ||
test('rcompare(v1, v2): 1 if v1 < v2', (t) => { | ||
t.is(rcompare('1', '2'), 1); | ||
@@ -31,0 +31,0 @@ t.is(rcompare('1.1', '1.2'), 1); |
@@ -11,10 +11,10 @@ import test from 'ava'; | ||
test('inc(v, release): not implemented', t => { | ||
t.throws(() => inc('1.1.0', 'major'), 'Not implemented'); | ||
t.throws(() => inc('1.1.0', 'premajor'), 'Not implemented'); | ||
t.throws(() => inc('1.1.0', 'minor'), 'Not implemented'); | ||
t.throws(() => inc('1.1.0', 'preminor'), 'Not implemented'); | ||
t.throws(() => inc('1.1.0', 'patch'), 'Not implemented'); | ||
t.throws(() => inc('1.1.0', 'prepatch'), 'Not implemented'); | ||
t.throws(() => inc('1.1.0', 'prerelease'), 'Not implemented'); | ||
test('inc(v, release): not implemented', (t) => { | ||
t.throws(() => inc('1.1.0', 'major'), { message: 'Not implemented' }); | ||
t.throws(() => inc('1.1.0', 'premajor'), { message: 'Not implemented' }); | ||
t.throws(() => inc('1.1.0', 'minor'), { message: 'Not implemented' }); | ||
t.throws(() => inc('1.1.0', 'preminor'), { message: 'Not implemented' }); | ||
t.throws(() => inc('1.1.0', 'patch'), { message: 'Not implemented' }); | ||
t.throws(() => inc('1.1.0', 'prepatch'), { message: 'Not implemented' }); | ||
t.throws(() => inc('1.1.0', 'prerelease'), { message: 'Not implemented' }); | ||
}); |
@@ -7,3 +7,3 @@ import test from 'ava'; | ||
test('major(v)', t => { | ||
test('major(v)', (t) => { | ||
t.is(major('1'), 1); | ||
@@ -10,0 +10,0 @@ t.is(major('1.2'), 1); |
@@ -7,3 +7,3 @@ import test from 'ava'; | ||
test('minor(v)', t => { | ||
test('minor(v)', (t) => { | ||
t.is(minor('1'), null); | ||
@@ -10,0 +10,0 @@ t.is(minor('1.2'), 2); |
@@ -7,3 +7,3 @@ import test from 'ava'; | ||
test('patch(v)', t => { | ||
test('patch(v)', (t) => { | ||
t.is(patch('1'), null); | ||
@@ -10,0 +10,0 @@ t.is(patch('1.2'), null); |
@@ -8,3 +8,3 @@ import test from 'ava'; | ||
test('prerelease(v)', t => { | ||
test('prerelease(v)', (t) => { | ||
t.deepEqual(prerelease('1.2.3.alpha.1'), ['alpha', 1]); | ||
@@ -11,0 +11,0 @@ t.deepEqual(prerelease('1.2.3.alpha.1.2'), ['alpha', 1, 2]); |
@@ -7,3 +7,3 @@ import test from 'ava'; | ||
test('valid(v)', t => { | ||
test('valid(v)', (t) => { | ||
t.is(valid('1'), '1'); | ||
@@ -10,0 +10,0 @@ t.is(valid('1.1'), '1.1'); |
@@ -10,4 +10,4 @@ import test from 'ava'; | ||
test('gtr(version, range): not implemented', t => { | ||
t.throws(() => gtr('1.1.2', '> 0.2, < 2.3'), 'Not implemented'); | ||
test('gtr(version, range): not implemented', (t) => { | ||
t.throws(() => gtr('1.1.2', '> 0.2, < 2.3'), { message: 'Not implemented' }); | ||
}); |
@@ -11,3 +11,3 @@ import test from 'ava'; | ||
if (res1 !== res2) { | ||
throw new Error(`Inconsistent result: ${r1} vs. ${r2}`) | ||
throw new Error(`Inconsistent result: ${r1} vs. ${r2}`); | ||
} | ||
@@ -17,3 +17,3 @@ return res1; | ||
test('intersects(range1, range2)', t => { | ||
test('intersects(range1, range2)', (t) => { | ||
t.true(testIntersects('1.1', '>= 1.1')); | ||
@@ -20,0 +20,0 @@ t.true(testIntersects('1.1.5', '1.1.5')); |
@@ -10,4 +10,4 @@ import test from 'ava'; | ||
test('ltr(version, range): not implemented', t => { | ||
t.throws(() => ltr('1.1.2', '> 0.2, < 2.3'), 'Not implemented'); | ||
test('ltr(version, range): not implemented', (t) => { | ||
t.throws(() => ltr('1.1.2', '> 0.2, < 2.3'), { message: 'Not implemented' }); | ||
}); |
@@ -8,11 +8,29 @@ import test from 'ava'; | ||
test('maxSatisfying(versions, range)', t => { | ||
test('maxSatisfying(versions, range)', (t) => { | ||
t.is(maxSatisfying(['1.2.3', '1.2.4'], '~> 1.2'), '1.2.4'); | ||
t.is(maxSatisfying(['1.2.3', '1.2.4', '1.2.5'], '~> 1.2, <= 1.2.4'), '1.2.4'); | ||
t.is(maxSatisfying(['1.2.4', '1.2.3'], '~> 1.2'), '1.2.4'); | ||
t.is(maxSatisfying(['1.2.3', '1.2.4', '1.2.5', '1.2.6'],'~> 1.2.3'), '1.2.6'); | ||
t.is(maxSatisfying(['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', | ||
'2.0.0b3', '2.0.0', '2.1.0'], '~> 2.0.0'), '2.0.0'); | ||
t.is( | ||
maxSatisfying(['1.2.3', '1.2.4', '1.2.5', '1.2.6'], '~> 1.2.3'), | ||
'1.2.6', | ||
); | ||
t.is( | ||
maxSatisfying( | ||
[ | ||
'1.1.0', | ||
'1.2.0', | ||
'1.2.1', | ||
'1.3.0', | ||
'2.0.0b1', | ||
'2.0.0b2', | ||
'2.0.0b3', | ||
'2.0.0', | ||
'2.1.0', | ||
], | ||
'~> 2.0.0', | ||
), | ||
'2.0.0', | ||
); | ||
t.is(maxSatisfying(['1.2.3', '1.2.4'], '> 3.2'), null); | ||
}); |
@@ -8,3 +8,3 @@ import test from 'ava'; | ||
test('minSatisfying(versions, range)', t => { | ||
test('minSatisfying(versions, range)', (t) => { | ||
t.is(minSatisfying(['1.2.3', '1.2.4'], '~> 1.2'), '1.2.3'); | ||
@@ -14,8 +14,21 @@ t.is(minSatisfying(['1.2.4', '1.2.3'], '~> 1.2'), '1.2.3'); | ||
t.is(minSatisfying(['1.2.3', '1.2.4', '1.2.5', '1.2.6'], '~>1.2.3'), '1.2.3'); | ||
t.is(minSatisfying(['1.1.0', '1.2.0', '1.2.1', '1.3.0', '2.0.0b1', '2.0.0b2', | ||
'2.0.0b3', '2.0.0', '2.1.0'], '~> 2.0.0'), '2.0.0'); | ||
t.is( | ||
minSatisfying( | ||
[ | ||
'1.1.0', | ||
'1.2.0', | ||
'1.2.1', | ||
'1.3.0', | ||
'2.0.0b1', | ||
'2.0.0b2', | ||
'2.0.0b3', | ||
'2.0.0', | ||
'2.1.0', | ||
], | ||
'~> 2.0.0', | ||
), | ||
'2.0.0', | ||
); | ||
t.is(minSatisfying(['1.2.3', '1.2.4'], '> 3.2'), null); | ||
}); | ||
@@ -11,5 +11,9 @@ import test from 'ava'; | ||
test('ltr(version, range): not implemented', t => { | ||
t.throws(() => outside('1.1.2', '> 0.2, < 2.3', '>'), 'Not implemented'); | ||
t.throws(() => outside('1.1.2', '> 0.2, < 2.3', '<'), 'Not implemented'); | ||
test('ltr(version, range): not implemented', (t) => { | ||
t.throws(() => outside('1.1.2', '> 0.2, < 2.3', '>'), { | ||
message: 'Not implemented', | ||
}); | ||
t.throws(() => outside('1.1.2', '> 0.2, < 2.3', '<'), { | ||
message: 'Not implemented', | ||
}); | ||
}); |
@@ -7,3 +7,3 @@ import test from 'ava'; | ||
test('satisfies(version, range)', t => { | ||
test('satisfies(version, range)', (t) => { | ||
t.true(satisfies('1.1', '>= 1.1')); | ||
@@ -10,0 +10,0 @@ t.true(satisfies('1.1.5', '~> 1.1.2')); |
@@ -7,3 +7,3 @@ import test from 'ava'; | ||
test('validRange(range)', t => { | ||
test('validRange(range)', (t) => { | ||
t.is(validRange('1.1'), '= 1.1'); | ||
@@ -10,0 +10,0 @@ t.is(validRange('~> 1.1'), '< 2, >= 1.1'); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
126962
62
2398
4
8
1
+ Addedtslib@^1.13.0
+ Addedtslib@1.14.1(transitive)