Sha256: 639d348b2c5b0e1690c790fbf6daa4a619ebcf52a1b675002fdb8b4b99823500

Contents?: true

Size: 1.46 KB

Versions: 77

Compression:

Stored size: 1.46 KB

Contents

const SemVer = require('../classes/semver')
const Range = require('../classes/range')
const gt = require('../functions/gt')

const minVersion = (range, loose) => {
  range = new Range(range, loose)

  let minver = new SemVer('0.0.0')
  if (range.test(minver)) {
    return minver
  }

  minver = new SemVer('0.0.0-0')
  if (range.test(minver)) {
    return minver
  }

  minver = null
  for (let i = 0; i < range.set.length; ++i) {
    const comparators = range.set[i]

    let setMin = null
    comparators.forEach((comparator) => {
      // Clone to avoid manipulating the comparator's semver object.
      const compver = new SemVer(comparator.semver.version)
      switch (comparator.operator) {
        case '>':
          if (compver.prerelease.length === 0) {
            compver.patch++
          } else {
            compver.prerelease.push(0)
          }
          compver.raw = compver.format()
          /* fallthrough */
        case '':
        case '>=':
          if (!setMin || gt(compver, setMin)) {
            setMin = compver
          }
          break
        case '<':
        case '<=':
          /* Ignore maximum versions */
          break
        /* istanbul ignore next */
        default:
          throw new Error(`Unexpected operation: ${comparator.operator}`)
      }
    })
    if (setMin && (!minver || gt(minver, setMin))) {
      minver = setMin
    }
  }

  if (minver && range.test(minver)) {
    return minver
  }

  return null
}
module.exports = minVersion

Version data entries

77 entries across 43 versions & 4 rubygems

Version Path
immosquare-cleaner-0.1.52 node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.52 node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.52 node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.52 node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.52 node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.52 node_modules/vue-eslint-parser/node_modules/semver/ranges/min-version.js
trusty-cms-6.3.1 node_modules/normalize-package-data/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.51 node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.51 node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.51 node_modules/vue-eslint-parser/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.51 node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.51 node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.51 node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.50 node_modules/vue-eslint-parser/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.50 node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.50 node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.50 node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.50 node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.50 node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js
immosquare-cleaner-0.1.49 node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree/node_modules/semver/ranges/min-version.js