How to use the check-more-types.has 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-updater / src / update-npm-modules.js View on Github external
.then(function (data) {
          la(check.array(data), 'could not get data for NPM package', name, data);
          var packageInfo = data[0];
          if (check.has(packageInfo, 'github')) {
            // console.log(packageInfo);
            githubRepos.push(packageToGithub(packageInfo));
          }
        });
    });
github bahmutov / all-nvm / src / cli-spec.js View on Github external
it('finds node version option', () => {
    const args = ['--node', '4', 'npm', 'version']
    const options = findOptions(args).options
    la(is.not.empty(options),
      'found options', options, 'in', args)
    la(is.has(options, 'node'), 'has node option', options)

    // list of versions
    la(is.array(options.node) &&
      options.node.length === 1, 'single version', options)
    la(options.node[0] === '4', 'found node 4', options)
  })
github bahmutov / copi / src / copi.js View on Github external
function install (options, db) {
  la(is.object(options), 'missing options', options)
  la(is.unemptyString(options.name), 'missing name', options)
  la(is.has(db, 'find'), 'missing find method in db')

  const found = db.find(options.name)

  if (!found || !found.latest) {
    console.error('Could not find locally installed "%s", using NPM to install', options.name)
    return npm.install({
      name: options.name,
      flags: options.flags
    })
  }
  console.log('found %s@%s among %d candidate(s)',
    options.name, found.latest, found.candidates.length)
  debug(found)

  la(is.unemptyString(found.folder), 'missing founder in found object', found)
github bahmutov / changed-log / src / utils-spec.js View on Github external
it('parses example .git', function () {
      var url = 'https://github.com/bahmutov/next-update.git'
      var info = parse(url)
      la(check.object(info), 'not an object', info)
      la(check.has(info, 'user'), 'missing user', info)
      la(check.has(info, 'repo'), 'missing repo', info)

      la(info.user === 'bahmutov', 'wrong user', info)
      la(info.repo === 'next-update', 'wrong repo', info)
    })
github bahmutov / changed-log / src / utils-spec.js View on Github external
it('parses example .git', function () {
      var url = 'https://github.com/bahmutov/next-update.git'
      var info = parse(url)
      la(check.object(info), 'not an object', info)
      la(check.has(info, 'user'), 'missing user', info)
      la(check.has(info, 'repo'), 'missing repo', info)

      la(info.user === 'bahmutov', 'wrong user', info)
      la(info.repo === 'next-update', 'wrong repo', info)
    })
github bahmutov / really-need / index.js View on Github external
function shouldFreeWhenDone(options) {
  la(check.object(options), 'missing options object', options);

  return ((check.has(options, 'keep') && !options.keep) ||
    (check.has(options, 'cache') && !options.cache));
}
github bahmutov / grunty / src / fake-gruntfile-code.js View on Github external
function isMultiTask(options) {
  return check.object(options) &&
    check.unemptyString(options.target) &&
    check.has(options, 'src') &&
    check.has(options, 'dest') &&
    check.maybe.object(options.config);
}
github bahmutov / copi / src / cache.js View on Github external
function loadData (maxAge, filename) {
  la(is.unemptyString(filename), 'missing filename', filename)
  if (!fs.existsSync(filename)) {
    return null
  }
  const text = fs.readFileSync(filename, 'utf-8')
  const withTimestamp = JSON.parse(text)
  la(is.has(withTimestamp, 'timestamp'), 'missing timestamp', Object.keys(withTimestamp))

  const now = new Date()
  const elapsed = now - new Date(withTimestamp.timestamp)
  debug('cache age', elapsed, 'ms, maxAge', maxAge)
  if (elapsed > maxAge) {
    return null
  }

  la(is.has(withTimestamp, 'data'), 'missing data', Object.keys(withTimestamp))
  return withTimestamp.data
}
github bahmutov / really-need / index.js View on Github external
function shouldFreeWhenDone(options) {
  la(check.object(options), 'missing options object', options);

  return ((check.has(options, 'keep') && !options.keep) ||
    (check.has(options, 'cache') && !options.cache));
}