Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@snyk/ruby-semver

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@snyk/ruby-semver - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

9

index.js
const api = {};
Object.assign(api, require('./lib/comparison'));
Object.assign(api, require('./lib/ranges'));
Object.assign(api, require('./lib/functions'));
module.exports = api;
module.exports = Object.assign(api,
require('./lib/comparison'),
require('./lib/ranges'),
require('./lib/functions'));

@@ -18,2 +18,15 @@ const { GemVersion, GemRequirement } = require('./generated');

function _expandTildes(gemRequirement) {
const requirements = [];
gemRequirement.$requirements().forEach(([op, version]) => {
if (op.indexOf('~') !== -1) {
requirements.push(`>= ${version}`);
requirements.push(`< ${version.$bump()}`);
} else {
requirements.push(`${op} ${version}`);
}
});
return GemRequirement.$create(requirements);
}
function validRange(range) {

@@ -24,3 +37,7 @@ if (range === null || range === undefined) { return null; }

try {
return _createRequirement(range).$to_s();
let requirement = _createRequirement(range);
if (range.indexOf('~') !== -1) {
requirement = _expandTildes(requirement);
}
return requirement.$to_s();
} catch (err) {

@@ -27,0 +44,0 @@ return null;

@@ -19,3 +19,3 @@ {

},
"version": "1.0.0"
"version": "1.1.0"
}

@@ -9,3 +9,6 @@ import test from 'ava';

t.is(validRange('1.1'), '= 1.1');
t.is(validRange('~> 1.1.0'), '~> 1.1.0');
t.is(validRange('~> 1.1'), '< 2, >= 1.1');
t.is(validRange('~> 1.1.0'), '< 1.2, >= 1.1.0');
t.is(validRange('~> 1.1.1.0'), '< 1.1.2, >= 1.1.1.0');
t.is(validRange('~> 1.1.1.beta.1'), '< 1.2, >= 1.1.1.beta.1');
t.is(validRange('> 2.1, < 2.4'), '< 2.4, > 2.1');

@@ -12,0 +15,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc