How to use the semver-parser.isValidSemVer function in semver-parser

To help you get started, we’ve selected a few semver-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asamuzaK / withExEditorHost / modules / main.js View on Github external
const exportHostVersion = async minVer => {
  if (!isString(minVer)) {
    throw new TypeError(`Expected String but got ${getType(minVer)}.`);
  }
  if (!isValidSemVer(minVer)) {
    throw new Error(`${minVer} is not valid SemVer.`);
  }
  const result = await compareSemVer(hostVersion, minVer);
  const latest = await getLatestHostVersion();
  let isLatest;
  if (latest) {
    const currentResult = await compareSemVer(hostVersion, latest);
    isLatest = currentResult >= 0;
  }
  const msg = {
    [HOST_VERSION]: {
      isLatest,
      latest,
      result,
    },
  };

semver-parser

SemVer parser. parse, verify, compare SemVer.

MIT
Latest version published 26 days ago

Package Health Score

67 / 100
Full package analysis

Similar packages