Socket
Socket
Sign inDemoInstall

compare-semver

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compare-semver

Compare semver versions to many other semver versions


Version published
Weekly downloads
47K
decreased by-10.56%
Maintainers
1
Weekly downloads
 
Created
Source

compare-semver

Compare semver versions to many other semver versions.

Install

npm install compare-semver --save

Usage

var compare = require('compare-semver');
var versions = [
  '0.0.11',
  '0.1.0',
  '0.2.0',
  '0.1.11'
];

var maxSemver = compare.max(versions);

Methods

max(versions)

Returns the greatest version from the list of versions

  • versions - an array of semantic versions

min(versions)

Returns the smallest version from the list of versions

  • versions - an array of semantic versions

gt(version, versions)

Compare that single version is greater than all versions in the list

  • version - the version to compare
  • versions - an array of semantic versions

lt(version, versions)

Compare that single version is less than all versions in the list

  • version - the version to compare
  • versions - an array of semantic versions

unique(version, versions)

Is the given version unique compared to the list of versions

  • version - the version to compare
  • versions - an array of semantic versions

Run Tests

npm install
npm test

FAQs

Package last updated on 01 Sep 2015

Did you know?

Socket

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.

Install

Related posts

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