Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

semver-diff

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Issues
File Explorer

Advanced tools

semver-diff

Get the diff type of two semver versions: 0.0.1 0.0.2 → patch

    4.0.0latest

Version published
Maintainers
1
Weekly downloads
7,489,060
decreased by-11.42%

Weekly downloads

Changelog

Source

Breaking

  • Require Node.js 12 5098db4
  • This package is now pure ESM. Please read this.

https://github.com/sindresorhus/semver-diff/compare/v3.1.1...v4.0.0

Readme

Source

semver-diff

Get the diff type of two semver versions: 0.0.1 0.0.2patch

Install

$ npm install semver-diff

Usage

import semverDiff from 'semver-diff'; semverDiff('1.1.1', '1.1.2'); //=> 'patch' semverDiff('1.1.1-foo', '1.1.2'); //=> 'prepatch' semverDiff('0.0.1', '1.0.0'); //=> 'major' semverDiff('0.0.1-foo', '1.0.0'); //=> 'premajor' semverDiff('0.0.1', '0.1.0'); //=> 'minor' semverDiff('0.0.1-foo', '0.1.0'); //=> 'preminor' semverDiff('0.0.1-foo', '0.0.1-foo.bar'); //=> 'prerelease' semverDiff('0.1.0', '0.1.0+foo'); //=> 'build' semverDiff('0.0.1', '0.0.1'); //=> undefined semverDiff('0.0.2', '0.0.1'); //=> undefined

API

semverDiff(versionA, versionB)

Returns the difference type between two semver versions, or undefined if they are identical or the second one is lower than the first.

Possible values:

  • 'major',
  • 'premajor',
  • 'minor',
  • 'preminor',
  • 'patch',
  • 'prepatch',
  • 'prerelease',
  • 'build',
  • undefined
  • latest-semver - Get the latest stable semver version from an array of versions
  • to-semver - Get an array of valid, sorted, and cleaned semver versions from an array of strings
  • semver-regex - Regular expression for matching semver versions
  • semver-truncate - Truncate a semver version: 1.2.31.2.0

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

What is semver-diff?

Get the diff type of two semver versions: 0.0.1 0.0.2 → patch

Is semver-diff popular?

The npm package semver-diff receives a total of 6,031,902 weekly downloads. As such, semver-diff popularity was classified as popular.

Is semver-diff well maintained?

We found that semver-diff 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.

Last updated on 03 May 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc