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

@hapi/somever

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hapi/somever - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

34

lib/index.js

@@ -35,6 +35,6 @@ 'use strict';

exports.match = function (version, range) {
exports.match = function (version, range, options) {
try {
return exports.range(range).match(version);
return exports.range(range).match(version, options);
}

@@ -58,3 +58,3 @@ catch (err) {

if (options.range &&
if (options.range && !options.includePrerelease &&
a.prerelease.length &&

@@ -85,11 +85,13 @@ (a.major !== b.major || a.minor !== b.minor || a.patch !== b.patch || !b.prerelease.length)) {

if (!a.prerelease.length &&
!b.prerelease.length) {
// With includePrerelease patch wildcard encompasses prereleases, otherwise prerelease < none
if (!a.prerelease.length && !b.prerelease.length) {
return 0;
}
if (!!a.prerelease.length !== !!b.prerelease.length) {
return (a.prerelease.length ? aFirst : bFirst); // prerelease < none
else if (!b.prerelease.length) {
return options.includePrerelease && b.patch === internals.any ? 0 : aFirst;
}
else if (!a.prerelease.length) {
return options.includePrerelease && a.patch === internals.any ? 0 : bFirst;
}

@@ -336,6 +338,6 @@ for (let i = 0; ; ++i) {

if (version.minor === internals.any) {
this._rule('<', { major: version.major + 1, minor: 0, patch: 0 });
this._rule('<', { major: version.major + 1, minor: 0, patch: 0, prerelease: [0] });
}
else {
this._rule('<', { major: version.major, minor: version.minor + 1, patch: 0 });
this._rule('<', { major: version.major, minor: version.minor + 1, patch: 0, prerelease: [0] });
}

@@ -365,10 +367,10 @@

if (version.minor === 0) {
this._rule('<', { major: 0, minor: 0, patch: version.patch + 1 });
this._rule('<', { major: 0, minor: 0, patch: version.patch + 1, prerelease: [0] });
}
else {
this._rule('<', { major: 0, minor: version.minor + 1, patch: 0 });
this._rule('<', { major: 0, minor: version.minor + 1, patch: 0, prerelease: [0] });
}
}
else {
this._rule('<', { major: version.major + 1, minor: 0, patch: 0 });
this._rule('<', { major: version.major + 1, minor: 0, patch: 0, prerelease: [0] });
}

@@ -459,3 +461,3 @@

match(version) {
match(version, options = {}) {

@@ -465,3 +467,3 @@ version = exports.version(version, this._settings); // Always parse to validate

if (this._anything) {
return !version.prerelease.length;
return !!options.includePrerelease || !version.prerelease.length;
}

@@ -478,3 +480,3 @@

for (const rule of rules) {
const compare = version.compare(rule.version, Object.assign(this._settings, { range: true }));
const compare = version.compare(rule.version, Object.assign(this._settings, options, { range: true }));
const exclude = Math.abs(compare) === 2;

@@ -481,0 +483,0 @@

{
"name": "@hapi/somever",
"description": "Semantic versioning rules parser",
"version": "4.0.0",
"version": "4.1.0",
"repository": "git://github.com/hapijs/somever",

@@ -27,3 +27,3 @@ "main": "lib/index.js",

"@hapi/eslint-plugin": "*",
"@hapi/lab": "25.0.0-beta.1"
"@hapi/lab": "^25.0.1"
},

@@ -30,0 +30,0 @@ "scripts": {

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