Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
semver-extra
Advanced tools
semver-extra contains useful methods that aren't included in the vanilla semver package.
semver-extra
contains useful methods that aren't included in the vanilla semver package.
The main reason semver-extra
exists is to deal with pre-release versions.
$ npm install semver-extra --save
var semver = require('semver-extra');
First of all, semver-extra
contains all methods of semver@4.x
, so we could use semver-extra
only without the vanilla one.
semver.validRange('^1.2.3'); // '>=1.2.3-0 <2.0.0-0'
semver.isStable('1.2.3'); // -> true
semver.isStable('1.2.3-stable'); // -> false
semver.isStable('1.2.3-alpha'); // -> false
Checks whether the version
is a stable version.
string
String=
prerelease
is not passed and version
is an unstable version, it will return true
.prerelease
could be the pre-release string.semver.isPrerelease('1.2.3'); // false
semver.isPrerelease('1.2.3-beta'); // true
semver.isPrerelease('1.2.3-beta', 'alpha'); // false
semver.isPrerelease('1.2.3-1.2.3', '1.2.3'); // true, that supports numeric prerelease versions
semver.isPrerelease('1.2.3-alpha.1', 'alpha.1'); // true
Checks whether the version
is an unstable version or matches the prerelease
.
var versions = [
'1.1.2'
'1.2.3-beta',
'1.2.2',
'1.2.1',
'1.3.3',
'1.5.0-rc'
];
semver.max(versions); // '1.5.0-rc'
Returns String
the maximun version in the list.
semver.maxStable(versions); // '1.3.3'
Returns String
the maximun stable version in the list.
semver.maxPrerelease(versions, 'alpha'); // null
semver.maxPrerelease(versions); // '1.5.0-rc'
semver.maxPrerelease(versions, 'beta'); // '1.2.3-beta'
Returns the maximun (matched) pre-release version matches the prerelease.
MIT
FAQs
semver-extra contains useful methods that aren't included in the vanilla semver package.
The npm package semver-extra receives a total of 1,540 weekly downloads. As such, semver-extra popularity was classified as popular.
We found that semver-extra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.