How to use the check-more-types.not 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 / utils.js View on Github external
function isPrerelease (version) {
  la(is.unemptyString(version), 'expected version string', version)
  // https://github.com/npm/node-semver#functions
  const prereleaseComponents = semver.prerelease(version)
  debug('version %s prerelease components %j', version, prereleaseComponents)
  return is.array(prereleaseComponents) && is.not.empty(prereleaseComponents)
}
github bahmutov / pre-compiled / bin / precompile.js View on Github external
var compiled = require('compiled')
la(is.fn(compiled.build), 'missing build', compiled)

var packageFilename = path.join(process.cwd(), './package.json')
var pkg = JSON.parse(fs.readFileSync(packageFilename))
var config = pkg.config && pkg.config['pre-compiled']
la(is.object(config),
  'missing pre-compiled config in package file', packageFilename)

// convert a string "files" value to an array
if (is.string(config.files)) {
  config.files = [config.files]
}

// choose "dist" as default output directory
if (is.not.unemptyString(config.dir)) {
  config.dir = 'dist'
}

la(is.all(config, {dir: is.unemptyString, files: is.array}),
  'invalid compiled config', config)

var nodeFeatures = require('../features/get-features')()
la(is.object(nodeFeatures), 'could not load node features')

// assuming pre-compiled module will do the bundle copy on the client side
config.moduleWithBabelPolyfill = 'pick-precompiled'

compiled.build(config)
  .then(function () {
    var versions = is.array(config.versions) && config.versions ||
      is.array(config.node) && config.node
github bahmutov / available-versions / src / split-version-spec.js View on Github external
it('handles just name', function () {
    const s = split('foo')
    la(is.object(s), s)
    la(s.name === 'foo', 'name', s)
    la(is.not.defined(s.version), 'version', s)
  })
github bahmutov / available-versions / src / human-format-spec.js View on Github external
{
          name: 'v1.0.0',
          body: '<a>nice</a>\nfirst release\n\nsecond line\n'
        },
        {
          name: 'v1.0.1',
          body: 'little fix'
        }
      ]
    }
    const human = toHuman(releases)
    la(human.length === releases.versions.length, 'wrong number of versions')
    checkOutput(human)
    const notes = human[0].release
    la(is.unemptyString(notes), 'missing notes', human)
    la(is.not.found(notes.indexOf('nice')), 'did not remove html line', notes)
    la(
      is.not.found(notes.indexOf('second line')),
      'did not remove second line',
      notes
    )
    console.log(notes)
  })
})
github bahmutov / generator-node-bahmutov / app / index.js View on Github external
_recordAnswers (answers) {
    la(is.unemptyString(answers.name), 'missing name', answers)

    if (is.not.unemptyString(answers.description)) {
      errors.onMissingDescription()
    }
    if (is.not.unemptyString(answers.keywords)) {
      errors.onMissingKeywords()
    }

    answers.keywords = answers.keywords.split(',').filter(isEmpty)
    this.answers = _.extend(defaults, answers)
    la(
      is.unemptyString(this.answers.name),
      'missing full name',
      this.answers.name
    )
    this.answers.noScopeName = withoutScope(this.answers.name)
    la(
      is.unemptyString(this.answers.noScopeName),
      'could not compute name without scope from',
      this.answers.name
    )
github bahmutov / schema-shot / src / compare.js View on Github external
const validateList = (schema, values) => {
  if (is.not.array(values)) {
    return {
      valid: false,
      message: 'expected an Array, got ' + typeof values
    }
  }
  let msg
  values.some(value => {
    const result = validate(schema, value)
    if (!result.valid) {
      msg = 'item in the list does not pass the schema\n' +
        formatErrors(result.errors) + '\n' + stringify(value)
      return true
    }
  })
  return {
    valid: msg === undefined,
github bahmutov / available-versions / src / human-format-spec.js View on Github external
name: 'v1.0.0',
          body: 'first release\n\nsecond line\n'
        },
        {
          name: 'v1.0.1',
          body: 'little fix'
        }
      ]
    }
    const human = toHuman(releases)
    la(human.length === releases.versions.length, 'wrong number of versions')
    checkOutput(human)
    const notes = human[0].release
    la(is.unemptyString(notes), 'missing notes', human)
    la(
      is.not.found(notes.indexOf('second line')),
      'did not remove second line',
      notes
    )
  })
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})`
  }
github bahmutov / changed-log / src / utils.js View on Github external
function isGithubName (str) {
  if (check.not.unemptyString(str)) {
    return false
  }
  var parsed = parseGh(str)
  return check.array(parsed)
}
github bahmutov / have-it / src / index.js View on Github external
const pickFoundVersion = target => found => {
  la(is.array(found), 'expected list of found items', found)

  if (is.not.semver(target)) {
    return latestVersion(found)
  }
  debug('need to pick version %s', target)
  debug('from list with %d found items', found.length)
  const sameVersion = R.propEq('version', target)
  return R.find(sameVersion, found)
}