How to use the semver.gte function in semver

To help you get started, we’ve selected a few semver 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 PGBI / kong-dashboard / tests / cases / infinite-scrolling.spec.js View on Github external
function create150APIs() {
  if (semver.gte(process.env.KONG_VERSION, '0.15.0')) {
    return Promise.resolve(0); // legacy since 0.15.0
  }
  var promise = createAPI(0);

  for (var i = 1; i < 150; i++) {
    let n = i;
    promise = promise.then(() => {
      return createAPI(n);
    });
  }

  return promise;
}
github gajus / global-agent / src / factories / createGlobalProxyAgent.js View on Github external
// $FlowFixMe
    http.globalAgent = httpAgent;

    // $FlowFixMe
    https.globalAgent = httpsAgent;
  }

  // The reason this logic is used in addition to overriding http(s).globalAgent
  // is because there is no guarantee that we set http(s).globalAgent variable
  // before an instance of http(s).Agent has been already constructed by someone,
  // e.g. Stripe SDK creates instances of http(s).Agent at the top-level.
  // @see https://github.com/gajus/global-agent/pull/13
  //
  // We still want to override http(s).globalAgent when possible to enable logic
  // in `bindHttpMethod`.
  if (semver.gte(process.version, 'v10.0.0')) {
    // $FlowFixMe
    http.get = bindHttpMethod(httpGet, httpAgent, configuration.forceGlobalAgent);

    // $FlowFixMe
    http.request = bindHttpMethod(httpRequest, httpAgent, configuration.forceGlobalAgent);

    // $FlowFixMe
    https.get = bindHttpMethod(httpsGet, httpsAgent, configuration.forceGlobalAgent);

    // $FlowFixMe
    https.request = bindHttpMethod(httpsRequest, httpsAgent, configuration.forceGlobalAgent);
  } else {
    log.warn('attempt to initialize global-agent in unsupported Node.js version was ignored');
  }

  return proxyController;
github azukiapp / azk / src / agent / configure.js View on Github external
return current.then((current) => {
      var valid = false, err_key = 'check_docker_version_error';
      try {
        valid = semver.gte(current, versions.required);
      } catch (e) {
        // Try extract version with regex
        if (_.isEmpty(force)) {
          var match = current.match(/(\d+\.\d+\.\d+)/);
          if (match) {
            current = match[0];
            return this._checkDockerVersion(current);
          }
        }
        err_key = 'check_docker_version_invalid';
      }

      if ( !valid ) {
        throw new DependencyError(err_key, {
          current_version: current,
          min_version    : versions.required,
github pantsel / konga / api / services / SnapshotsService.js View on Github external
KongService.nodeInfo(node, function (err, status) {
      if (err) {
        return cb(err);
      }

      var result = {}

      var endpoints = ['/apis', '/plugins', '/consumers']

      status.version = Utils.ensureSemverFormat(status.version);

      if (semver.gte(status.version, '0.10.0')) {
        endpoints = endpoints.concat(['/upstreams']);
      }

      if (semver.gte(status.version, '0.13.0')) {
        endpoints = endpoints.concat(['/services', '/routes']);
      }


      var fns = []

      endpoints.forEach(function (endpoint) {
        fns.push(function (cb) {
          KongService.listAllCb(node, endpoint, function (err, data) {
            if (err) {
              return cb(err);
            }
            result[endpoint.replace("/", "")] = data.data
            return cb();
          });
        });
github streamlink / streamlink-twitch-gui / build / tasks / webpack / configurators / ember / compatibility-helpers.js View on Github external
source: "ember-compatibility-helpers",
						flags: {
							DEBUG: false,
							HAS_UNDERSCORE_ACTIONS: !gte( emberVersion, "2.0.0" ),
							HAS_MODERN_FACTORY_INJECTIONS: gte( emberVersion, "2.13.0" ),
							HAS_DESCRIPTOR_TRAP: satisfies( emberVersion, "~3.0.0" ),
							HAS_NATIVE_COMPUTED_GETTERS: gte( emberVersion, "3.1.0-beta.1" ),
							IS_GLIMMER_2: gte( emberVersion, "2.10.0" ),
							SUPPORTS_FACTORY_FOR: gte( emberVersion, "2.12.0" ),
							//|| 'ember-factory-for-polyfill' .gte('1.0.0'),
							SUPPORTS_GET_OWNER: gte( emberVersion, "2.3.0" ),
							//|| 'ember-getowner-polyfill' .gte('1.1.0'),
							SUPPORTS_SET_OWNER: gte( emberVersion, "2.3.0" ),
							SUPPORTS_NEW_COMPUTED: gte( emberVersion, "1.12.0-beta.1" ),
							SUPPORTS_INVERSE_BLOCK: gte( emberVersion, "1.13.0" ),
							SUPPORTS_CLOSURE_ACTIONS: gte( emberVersion, "1.13.0" ),
							SUPPORTS_UNIQ_BY_COMPUTED: gte( emberVersion, "2.7.0" )
						}
					}],
					externalizeHelpers: {
						global: "Ember"
					},
					debugTools: {
						isDebug: false,
						source: "ember-compatibility-helpers",
						assertPredicateIndex: 1
					}
				} ]
			]
		})
	});
github inikulin / publish-please / src / utils / get-node-infos.js View on Github external
function npmPackCanReportInJson(version) {
    return semver.gte(version, NPM_VERSION_WITH_PACK_JSON_REPORTER);
}
github eslint / eslint / lib / eslint / util.js View on Github external
function isThreadSupported() {
    return semver.gte(process.versions.node, "12.11.0");
}
github burst-apps-team / phoenix / web / angular-wallet / src / app / setup / account / account.service.ts View on Github external
numberOfConfirmations?: number,
    type?: number,
    subtype?: number
  ): Promise {

    const args = {
      accountId,
      firstIndex,
      lastIndex,
      numberOfConfirmations,
      type,
      subtype,
    };
    try {
      const apiVersion = await this.apiService.fetchBrsApiVersion();
      const includeMultiouts = semver.gte(apiVersion, constants.multiOutMinVersion, {includePrerelease: true}) || undefined;
      const transactions = await this.api.account.getAccountTransactions({
        ...args,
        includeIndirect: includeMultiouts
      });
      return Promise.resolve(transactions);
    } catch (e) {
      const EC_INVALID_ARG = 4;
      if (e.data.errorCode === EC_INVALID_ARG) {
        return await this.api.account.getAccountTransactions(args);
      } else {
        throw e;
      }
    }
  }
github davidhealey / waistline / node_modules / npm / lib / install / deps.js View on Github external
function computeVersionSpec (tree, child) {
  validate('OO', arguments)
  var requested
  var childReq = child.package._requested
  if (childReq && (isNotEmpty(childReq.saveSpec) || (isNotEmpty(childReq.rawSpec) && isNotEmpty(childReq.fetchSpec)))) {
    requested = child.package._requested
  } else if (child.package._from) {
    requested = npa(child.package._from)
  } else {
    requested = npa.resolve(child.package.name, child.package.version)
  }
  if (isRegistry(requested)) {
    var version = child.package.version
    var rangeDescriptor = ''
    if (semver.valid(version, true) &&
        semver.gte(version, '0.1.0', true) &&
        !npm.config.get('save-exact')) {
      rangeDescriptor = npm.config.get('save-prefix')
    }
    return rangeDescriptor + version
  } else if (requested.type === 'directory' || requested.type === 'file') {
    return 'file:' + unixFormatPath(path.relative(tree.path, requested.fetchSpec))
  } else {
    return requested.saveSpec || requested.rawSpec
  }
}
github aws / aws-xray-sdk-node / packages / core / lib / patchers / aws_p.js View on Github external
var captureAWS = function captureAWS(awssdk) {
  if (!semver.gte(awssdk.VERSION, minVersion))
    throw new Error ('AWS SDK version ' + minVersion + ' or greater required.');

  for (var prop in awssdk) {
    if (awssdk[prop].serviceIdentifier) {
      var Service = awssdk[prop];
      Service.prototype.customizeRequests(captureAWSRequest);
    }
  }

  return awssdk;
};