How to use the check-more-types.empty 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 / comment-value / src / instrument-source.js View on Github external
function isWhiteSpaceBefore (from, comment) {
    const region = source.substr(from, comment.start - from)
    if (is.empty(region)) {
      return true
    }
    // console.log(`region "${region}" from ${from} comment starts ${comment.start}`)
    const maybe = isWhiteSpace(region)
    // console.log(`region "${region}" test ${maybe}`)
    return maybe
  }
github bahmutov / next-update / src / next-update.js View on Github external
function makeSureValidModule (moduleNames, checkingModules) {
  la(check.maybe.array(moduleNames), 'expected list of modules', moduleNames)
  la(check.array(checkingModules), 'expected list of modules to check', checkingModules)
  if (isSingleItem(moduleNames) && check.empty(checkingModules)) {
    console.error('Could not find module "%s" in the list of dependencies', moduleNames[0])
    console.error('Please check the name')
    process.exit(-1)
  }
}
github bahmutov / have-it / src / index.js View on Github external
function npmInstall (list, options) {
  la(is.array(list), 'expected list of modules to npm install', list)
  la(is.strings(options), 'expected list of CLI options', options)

  if (is.empty(list)) {
    return Promise.resolve()
  }
  const flags = options.join(' ')
  const names = list.map(fullInstallName).join(' ')
  const cmd = `npm install ${flags} ${names}`
  console.log(cmd)
  return execa.shell(cmd)
}
github bahmutov / dont-break / src / dont-break.js View on Github external
function dontBreakDependents (options, dependents) {
  if (check.arrayOf(check.object, dependents) || check.arrayOfStrings(dependents)) {
    dependents = {
      projects: dependents
    }
  }
  la(check.arrayOf(function (item) {
    return check.object(item) || check.string(item)
  }, dependents.projects), 'invalid dependents', dependents.projects)
  debug('dependents', dependents)
  if (check.empty(dependents)) {
    return Promise.resolve()
  }

  banner('  testing the following dependents\n  ' + JSON.stringify(dependents))

  var logSuccess = function logSuccess () {
    console.log('all dependents tested')
  }

  return testDependents(options, dependents)
    .then(logSuccess)
}
github bahmutov / snap-shot-core / src / prune.js View on Github external
const pruneSnapshotsInFile = ({ fs, byFilename, ext }, opts) => file => {
  const snapshots = fs.loadSnapshots(file, ext, {
    useRelativePath: opts.useRelativePath || false
  })
  if (is.empty(snapshots)) {
    debug('empty snapshots to prune in file', file)
    return
  }

  const runtimeSnapshots = byFilename[file]
  debug('run time snapshots by file')
  debug(runtimeSnapshots)

  const prunedSnapshots = pruneSnapshotsInObject(runtimeSnapshots, snapshots)
  if (R.equals(prunedSnapshots, snapshots)) {
    debug('nothing to prune for file', file)
    return
  }

  debug('saving pruned snapshot file for', file)
github bahmutov / all-nvm / src / find-options.js View on Github external
function findOptions (args) {
  la(is.array(args), 'expected list of arguments', args)

  const options = {}
  const result = {
    options: options,
    args: args
  }

  if (is.empty(args)) {
    return result
  }

  if (!isOption(args[0])) {
    return result
  }

  if (!isKnownOption(args[0])) {
    debug('unknown option', args[0])
    return result
  }
  debug('has option', args[0])

  const normalName = normalizeOptionName(args[0])
  const normalValue = normalizeOption(args[1])
  debug('normalized', normalName, '=', normalValue)
github bahmutov / rambo / src / produce.js View on Github external
function deriveRange (output) {
  if (is.not.array(output)) {
    return
  }
  if (is.empty(output)) {
    return
  }
  if (!output.every(is.number)) {
    return
  }
  const first = output[0]
  const last = R.last(output)
  la(is.number(last), 'invalid last element in list', output)
  const after = last + 1
  return {
    f: R.always(R.range(first, after)),
    name: `R.range(${first}, ${after})`
  }
}