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

semver

Package Overview
Dependencies
Maintainers
2
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semver

The semantic version parser used by npm.

  • 4.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
333M
decreased by-6.55%
Maintainers
2
Weekly downloads
 
Created

What is semver?

The semver package is a module for semantic versioning (semver) parsing and comparison. It provides utilities for working with semantic version numbers, allowing users to parse, compare, increment, and manipulate version numbers according to the semantic versioning specification.

What are semver's main functionalities?

Parsing and Validating Versions

This feature allows you to parse a version string and check if it is a valid semantic version.

"const semver = require('semver');
const version = '1.2.3';
const valid = semver.valid(version); // '1.2.3'"

Comparing Versions

This feature enables you to compare two semantic version numbers to determine their order.

"const semver = require('semver');
const v1 = '1.2.3';
const v2 = '4.5.6';
const comparison = semver.compare(v1, v2); // -1"

Incrementing Versions

This feature allows you to increment a version number by the major, minor, or patch version.

"const semver = require('semver');
const version = '1.2.3';
const incremented = semver.inc(version, 'patch'); // '1.2.4'"

Ranges and Satisfaction

This feature checks if a version satisfies a given range.

"const semver = require('semver');
const version = '1.2.3';
const range = '^1.0.0';
const satisfied = semver.satisfies(version, range); // true"

Coercion

This feature coerces a string to a semantic version if possible.

"const semver = require('semver');
const version = 'v1';
const coerced = semver.coerce(version); // '1.0.0'"

Other packages similar to semver

FAQs

Package last updated on 10 Feb 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