Socket
Socket
Sign inDemoInstall

compare-versions

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compare-versions - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

bower.json
{
"name": "compare-versions",
"version": "2.0.0",
"version": "2.0.1",
"description": "Compare semver version strings to find greater, equal or lesser.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -34,3 +34,3 @@ /* global define */

if ((s1[2] + s2[2]).indexOf('-') > -1) {
if ((s1[2] + s2[2] + '').indexOf('-') > -1) {
var p1 = (patchPattern.exec(s1[2]) || [''])[0];

@@ -37,0 +37,0 @@ var p2 = (patchPattern.exec(s2[2]) || [''])[0];

{
"name": "compare-versions",
"version": "2.0.0",
"version": "2.0.1",
"description": "Compare semver version strings to find greater, equal or lesser.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,3 +5,3 @@ var assert = require('assert');

describe('compare versions', function () {
it('should compare versions correctly', function () {
it('should compare three-segment versions correctly', function () {
assert.equal(compare('10.1.8', '10.0.4'), 1);

@@ -12,2 +12,14 @@ assert.equal(compare('10.0.1', '10.0.1'), 0);

it('should compare two-segment versions correctly', function () {
assert.equal(compare('10.8', '10.4'), 1);
assert.equal(compare('10.1', '10.1'), 0);
assert.equal(compare('10.1', '10.2'), -1);
});
it('should compare single-segment versions correctly', function () {
assert.equal(compare('10', '9'), 1);
assert.equal(compare('10', '10'), 0);
assert.equal(compare('9', '10'), -1);
});
it('should compare versions with different number of digits in same group', function () {

@@ -14,0 +26,0 @@ assert.equal(compare('11.0.10', '11.0.2'), 1);

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