Have ideas to improve npm?Join in the discussion! »

    semver-level-harmony

    1.0.1 • Public • Published

    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.

    Install

    npm i semver-level-harmony

    DownloadsWeekly Downloads

    1

    Version

    1.0.1

    License

    GPL-3.0+

    Last publish

    Collaborators

    • avatar