How to use the check-more-types.url 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 / start-server-and-test / src / utils.js View on Github external
return str.every(s => {
    if (is.url(s)) {
      return s
    }
    // wait-on allows specifying HTTP verb to use instead of default HEAD
    // and the format then is like "http-get://domain.com" to use GET
    if (isWaitOnUrl(s)) {
      return s
    }

    if (is.number(s)) {
      return is.port(s)
    }
    if (!is.string(s)) {
      return false
    }
    if (s[0] === ':') {
      const withoutColon = s.substr(1)
github bahmutov / npm-utils / src / form-auth-token.js View on Github external
function formAuthToken (registryUrl, tokenEnvName) {
  if (!tokenEnvName) {
    if (!process.env.NPM_TOKEN) {
      throw new Error('Cannot find NPM_TOKEN\nuse ' + getNpmToken + ' to get one')
    }
    tokenEnvName = 'NPM_TOKEN'
  }
  la(is.url(registryUrl), 'npm registry should be an url', registryUrl)

  // strip protocol http/https part
  registryUrl = registryUrl.replace('https:', '')
  registryUrl = registryUrl.replace('http:', '')

  var line = registryUrl + ':_authToken='
  var fullLine = line + '${' + tokenEnvName + '}'

  return {
    test: line,
    token: fullLine
  }
}
github cypress-io / cypress / scripts / utils.js View on Github external
function getJustVersion (npmNameOrUrl) {
  la(is.unemptyString(npmNameOrUrl), 'missing NPM string', npmNameOrUrl)

  if (npmNameOrUrl.startsWith('cypress')) {
    return npmNameOrUrl
  }

  if (is.url(npmNameOrUrl)) {
    // try finding semver in the url
    // https://something/0.20.3/something...
    const re = /\/(\d+\.\d+\.\d+(-\w+)?)\//
    const matches = re.exec(npmNameOrUrl)

    if (matches) {
      return matches[1]
    }
  }

  return npmNameOrUrl
}
github cypress-io / cypress / packages / server / lib / browsers / chrome.js View on Github external
const _navigateUsingCRI = function (url) {
  la(check.url(url), 'missing url to navigate to', url)

  return function (client) {
    la(client, 'could not get CRI client')
    debug('received CRI client')
    debug('navigating to page %s', url)

    // when opening the blank page and trying to navigate
    // the focus gets lost. Restore it and then navigate.
    return client.send('Page.bringToFront')
    .then(() => {
      return client.send('Page.navigate', { url })
    })
  }
}
github cypress-io / cypress-test-example-repos / test-repo.js View on Github external
const formRepoUrl = (name) => {
  if (is.url(name)) {
    return name
  }
  if (hasOwnerAndName(name)) {
    return `https://github.com/${name}.git`
  } else {
    return `https://github.com/cypress-io/${name}.git`
  }
}
github bahmutov / now-pipeline / bin / now-pipeline.js View on Github external
function findDeploy (url) {
  la(is.url(url), 'expected url', url)

  return nowPipeline.deployments()
    .then(deploys => {
      debug('looking for url %s in %d deploys', url, deploys.length)

      const found = deploys.find(d => {
        return url.endsWith(d.url)
      })
      if (!found) {
        console.error('Could not find deploy for url', url)
        process.exit(-1)
      }
      debug('found deployment', found)
      return found
    })
}
github bahmutov / dont-break / src / is-repo-url.js View on Github external
function isRepoUrl (s) {
  return (is.git(s) || is.url(s)) && isGitHub(s)
}
github cypress-io / cypress / cli / lib / tasks / download.js View on Github external
const getUrl = (version) => {
  if (is.url(version)) {
    debug('version is already an url', version)
    return version
  }
  return version ? prepend(`desktop/${version}`) : prepend('desktop')
}
github cypress-io / cypress / cli / lib / tasks / download.js View on Github external
const getUrl = (version) => {
  if (is.url(version)) {
    debug('version is already an url', version)

    return version
  }

  return version ? prepend(`desktop/${version}`) : prepend('desktop')
}