How to use the check-more-types.arrayOf 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 / available-versions / src / human-format.js View on Github external
function versionsWithoutTimestamps (releases, tags) {
  const vers = releases.versions
  if (is.arrayOf(semverAllowTags, vers)) {
    debug('returning versions without timestamps')
    // debug(releases);
    return vers.map(version => {
      const result = {
        version: version
      }
      if (tags && tags[version]) {
        result['dist-tag'] = tags[version]
      }
      return result
    })
  }
  if (is.arrayOf(is.object, vers)) {
    la(
      vers.every(is.has('version')),
      'some objects do not have version property',
github bahmutov / available-versions / src / human-format.js View on Github external
function versionsWithoutTimestamps (releases, tags) {
  const vers = releases.versions
  if (is.arrayOf(semverAllowTags, vers)) {
    debug('returning versions without timestamps')
    // debug(releases);
    return vers.map(version => {
      const result = {
        version: version
      }
      if (tags && tags[version]) {
        result['dist-tag'] = tags[version]
      }
      return result
    })
  }
  if (is.arrayOf(is.object, vers)) {
    la(
      vers.every(is.has('version')),
      'some objects do not have version property',
      releases
    )
    return _.pluck(vers, 'version')
  }
  throw new Error(
    'Cannot extract versions from ' + JSON.stringify(releases, null, 2)
  )
}
github bahmutov / available-versions / src / human-format-spec.js View on Github external
it('does not like tags in list', function () {
    var versions = ['0.0.0-semantic-release', '0.0.0', '0.1.0']
    la(!is.arrayOf(is.semver, versions), 'not sem vers', versions)
  })
})
github bahmutov / available-versions / src / semver-allow-tags-spec.js View on Github external
it('handles list with tags', function () {
    var versions = [
      '0.0.0-semantic-release',
      '0.0.0',
      '0.1.0'
    ]
    la(is.arrayOf(semverAllowTags, versions),
      'not sem vers', versions)
  })
})
github bahmutov / available-versions / src / human-format-spec.js View on Github external
it('handles clean list', function () {
    var versions = ['0.0.0', '0.0.2', '0.1.0']
    la(is.arrayOf(is.semver, versions), 'not sem vers', versions)
  })
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')
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)
}