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

semver-level-harmony

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semver-level-harmony

Compare if two semver version range levels are the same.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

semver-level-harmony

Travis Build Status

Compare if two semver version range levels are the same. The world is complex, sometimes dependencies rely on others to have the same version level. For example Spectron expects Electron to have the same minor version. Testing if these two modules have the same minor version makes this implicit relation explicit, getting them in harmony.

The module is smart enough to notice a range is too wide to compare on certain levels. For example comparing the minor level on ^1.2.3 is impossible since the installed version can go up to 1.9.9.

This module is small and simple with the downside being it only supports semver ranges with three defined numbers. This is a range you get by default when installing a module with the npm CLI.

Usage

npm install semver-level-harmony --save-dev

Example testing Spectron and Electron minor version:

const assert = require('assert');
const semverLevelHarmony = require('semver-level-harmony');
const { electron, spectron } = require('./package.json').devDependencies;

assert.ok(
  semverLevelHarmony('minor', electron, spectron),
  'electron and spectron version minor levels are the same'
);

API

semverLevelHarmony(level, versionRange, versionRange)

level

Type: string
Version semver level: major, minor or patch.

versionRange

Type: string
The version semver range.

Keywords

FAQs

Package last updated on 25 Aug 2017

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