mwg API
    Preparing search index...

    Function satisfiesVersionRange

    • Checks a version against a small semver range: >=, >, <=, <, ^, ~, an exact version or a partial one (0.42 is 0.42.x), several separated by spaces (all must hold) and alternatives separated by ||. A pre-release or build suffix on the version is ignored. A malformed range throws a PackageFormatError.

      Parameters

      • version: string
      • range: string

      Returns boolean

      import { satisfiesVersionRange } from '@datamoc/mwg/mwl';

      console.log(satisfiesVersionRange('0.43.0', '>=0.42 <1')); // true
      console.log(satisfiesVersionRange('0.43.0', '^0.42.0')); // false