Sha256: 431e82902f7604755ba826f922866ea63d245986136ac520fa3cb882a8c34fdd

Contents?: true

Size: 634 Bytes

Versions: 42

Compression:

Stored size: 634 Bytes

Contents

const parse = require('./parse')
const eq = require('./eq')

const diff = (version1, version2) => {
  if (eq(version1, version2)) {
    return null
  } else {
    const v1 = parse(version1)
    const v2 = parse(version2)
    const hasPre = v1.prerelease.length || v2.prerelease.length
    const prefix = hasPre ? 'pre' : ''
    const defaultResult = hasPre ? 'prerelease' : ''
    for (const key in v1) {
      if (key === 'major' || key === 'minor' || key === 'patch') {
        if (v1[key] !== v2[key]) {
          return prefix + key
        }
      }
    }
    return defaultResult // may be undefined
  }
}
module.exports = diff

Version data entries

42 entries across 35 versions & 4 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/css-loader/node_modules/semver/functions/diff.js
decidim-0.27.1 packages/webpacker/node_modules/semver/functions/diff.js
decidim-0.26.4 packages/webpacker/node_modules/semver/functions/diff.js
decidim-0.27.0 packages/webpacker/node_modules/semver/functions/diff.js
decidim-0.26.3 packages/webpacker/node_modules/semver/functions/diff.js
decidim-0.27.0.rc2 packages/webpacker/node_modules/semver/functions/diff.js
decidim-0.27.0.rc1 packages/webpacker/node_modules/semver/functions/diff.js
appmap-0.72.2 ./node_modules/semver/functions/diff.js
appmap-0.72.1 ./node_modules/semver/functions/diff.js
appmap-0.72.0 ./node_modules/semver/functions/diff.js
appmap-0.71.0 ./node_modules/semver/functions/diff.js
disco_app-0.16.1 test/dummy/node_modules/@npmcli/fs/node_modules/semver/functions/diff.js
disco_app-0.16.1 test/dummy/node_modules/sass-loader/node_modules/semver/functions/diff.js
appmap-0.70.2 ./node_modules/semver/functions/diff.js
appmap-0.70.1 ./node_modules/semver/functions/diff.js
appmap-0.70.0 ./node_modules/semver/functions/diff.js
appmap-0.69.0 ./node_modules/semver/functions/diff.js
appmap-0.68.2 ./node_modules/semver/functions/diff.js
appmap-0.68.1 ./node_modules/semver/functions/diff.js
disco_app-0.15.2 test/dummy/node_modules/@npmcli/fs/node_modules/semver/functions/diff.js