@0x-lerna-fork/has-npm-version

Test if the current version of npm satisfies a given semver range

Usage no npm install needed!

<script type="module">
  import 0xLernaForkHasNpmVersion from 'https://cdn.skypack.dev/@0x-lerna-fork/has-npm-version';
</script>

README

@0x-lerna-fork/has-npm-version

Test if the current version of npm satisfies a given semver range

Usage

const hasNpmVersion = require("@0x-lerna-fork/has-npm-version");

// `npm --version` === 6.3.0
hasNpmVersion(">=6"); // => true

// `npm --version` === 5.6.0
hasNpmVersion(">=6"); // => false

// makePredicate() caches the call to `npm --version`
// useful if you're calling it repeatedly in a loop
const predicate = hasNpmVersion.makePredicate();

// `npm --version` === 6.3.0
hasNpmVersion(">=5"); // => true

Install lerna for access to the lerna CLI.