How to use the diff function from semver

Find comprehensive JavaScript semver.diff code examples handpicked from public code repositorys.

325
326
327
328
329
330
331
332
333
334
        ? 'next'
        : 'latest'
    : 'latest';
let version = info.npmPackageJson['dist-tags'][tag];
let target = info.npmPackageJson.versions[version];
const versionDiff = semver.diff(info.installed.version, version);
if (versionDiff !== 'patch' &&
    versionDiff !== 'minor' &&
    /^@(?:angular|nguniversal)\//.test(name)) {
    const installedMajorVersion = (_a = semver.parse(info.installed.version)) === null || _a === void 0 ? void 0 : _a.major;
fork icon1
star icon0
watch icon0

471
472
473
474
475
476
477
478
479
  return node
}

// look for newer versions that differ from current by a specific part of the semver version
if (['major', 'minor', 'patch'].includes(outdatedKind)) {
  // filter the versions greater than our current one based on semver.diff
  const filteredVersions = greaterVersions.filter((version) => {
    return semver.diff(node.version, version) === outdatedKind
  })
fork icon0
star icon0
watch icon1

+ 9 other calls in file