How to use the check-more-types.verify.unemptyString function in check-more-types

To help you get started, we’ve selected a few check-more-types 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 bahmutov / next-update / src / stats.js View on Github external
function getSuccessStats (options) {
  verify.unemptyString(options.name, 'missing name')
  verify.unemptyString(options.from, 'missing from version')
  verify.unemptyString(options.to, 'missing to version')

  verify.webUrl(nextUpdateStatsUrl, 'missing next update stats server url')
  var opts = {
    uri: nextUpdateStatsUrl + '/package/' + options.name + '/' + options.from +
            '/' + options.to,
    method: 'GET',
    json: options
  }
  var defer = Q.defer()
  request(opts, function (err, response, stats) {
    if (err || response.statusCode !== 200) {
      if (response) {
        if (response.statusCode !== 404) {
          console.error('could not get success stats for', options.name)
          console.error(opts)
        }
github bahmutov / next-update / src / stats.js View on Github external
function getSuccessStats (options) {
  verify.unemptyString(options.name, 'missing name')
  verify.unemptyString(options.from, 'missing from version')
  verify.unemptyString(options.to, 'missing to version')

  verify.webUrl(nextUpdateStatsUrl, 'missing next update stats server url')
  var opts = {
    uri: nextUpdateStatsUrl + '/package/' + options.name + '/' + options.from +
            '/' + options.to,
    method: 'GET',
    json: options
  }
  var defer = Q.defer()
  request(opts, function (err, response, stats) {
    if (err || response.statusCode !== 200) {
      if (response) {
        if (response.statusCode !== 404) {
          console.error('could not get success stats for', options.name)
github bahmutov / next-update / src / stats.js View on Github external
function sendUpdateResult (options) {
  verify.unemptyString(options.name, 'missing name')
  verify.unemptyString(options.from, 'missing from version')
  verify.unemptyString(options.to, 'missing to version')
  if (options.success) {
    options.success = !!options.success
  }

  verify.webUrl(nextUpdateStatsUrl, 'missing next update stats server url')
  var sendOptions = {
    uri: nextUpdateStatsUrl + '/update',
    method: 'POST',
    json: options
  }
  request(sendOptions, function ignoreResponse () {})
}
github bahmutov / next-update / src / stats.js View on Github external
function sendUpdateResult (options) {
  verify.unemptyString(options.name, 'missing name')
  verify.unemptyString(options.from, 'missing from version')
  verify.unemptyString(options.to, 'missing to version')
  if (options.success) {
    options.success = !!options.success
  }

  verify.webUrl(nextUpdateStatsUrl, 'missing next update stats server url')
  var sendOptions = {
    uri: nextUpdateStatsUrl + '/update',
    method: 'POST',
    json: options
  }
  request(sendOptions, function ignoreResponse () {})
}
github bahmutov / next-update / src / stats.js View on Github external
function formatStats (options, stats) {
  verify.object(stats, 'missing stats object')
  verify.unemptyString(stats.name, 'missing name')
  verify.unemptyString(stats.from, 'missing from version')
  verify.unemptyString(stats.to, 'missing to version')
  stats.success = +stats.success || 0
  stats.failure = +stats.failure || 0
  var total = stats.success + stats.failure
  var probability = (total > 0 ? stats.success / total : 0)
  var probabilityStr = colorProbability(probability, options)
  return oneLine`
    stats: ${stats.name} ${stats.from} -> ${stats.to}
    success probability ${probabilityStr}
    ${stats.success} ${pluralize('success', stats.success)}
    ${stats.failure} ${pluralize('failure', stats.failure)}
  `
}
github bahmutov / next-update / src / stats.js View on Github external
function formatStats (options, stats) {
  verify.object(stats, 'missing stats object')
  verify.unemptyString(stats.name, 'missing name')
  verify.unemptyString(stats.from, 'missing from version')
  verify.unemptyString(stats.to, 'missing to version')
  stats.success = +stats.success || 0
  stats.failure = +stats.failure || 0
  var total = stats.success + stats.failure
  var probability = (total > 0 ? stats.success / total : 0)
  var probabilityStr = colorProbability(probability, options)
  return oneLine`
    stats: ${stats.name} ${stats.from} -> ${stats.to}
    success probability ${probabilityStr}
    ${stats.success} ${pluralize('success', stats.success)}
    ${stats.failure} ${pluralize('failure', stats.failure)}
  `
}
github bahmutov / next-update / src / stats.js View on Github external
function formatStats (options, stats) {
  verify.object(stats, 'missing stats object')
  verify.unemptyString(stats.name, 'missing name')
  verify.unemptyString(stats.from, 'missing from version')
  verify.unemptyString(stats.to, 'missing to version')
  stats.success = +stats.success || 0
  stats.failure = +stats.failure || 0
  var total = stats.success + stats.failure
  var probability = (total > 0 ? stats.success / total : 0)
  var probabilityStr = colorProbability(probability, options)
  return oneLine`
    stats: ${stats.name} ${stats.from} -> ${stats.to}
    success probability ${probabilityStr}
    ${stats.success} ${pluralize('success', stats.success)}
    ${stats.failure} ${pluralize('failure', stats.failure)}
  `
}
github bahmutov / next-update / src / stats.js View on Github external
function sendUpdateResult (options) {
  verify.unemptyString(options.name, 'missing name')
  verify.unemptyString(options.from, 'missing from version')
  verify.unemptyString(options.to, 'missing to version')
  if (options.success) {
    options.success = !!options.success
  }

  verify.webUrl(nextUpdateStatsUrl, 'missing next update stats server url')
  var sendOptions = {
    uri: nextUpdateStatsUrl + '/update',
    method: 'POST',
    json: options
  }
  request(sendOptions, function ignoreResponse () {})
}