How to use the check-more-types.webUrl 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 / snap-shot / src / browser-system.js View on Github external
function init () {
  // find out the source for all test -> this spec file
  const sites = callsites()
  la(sites.length, 'missing callsite')
  const specFileUrl = sites[1].filename
  la(is.webUrl(specFileUrl), 'missing spec url', specFileUrl)
  console.log('loading spec from', specFileUrl)

  // specFileUrl is something like
  // http://localhost:49829/__cypress/tests?p=cypress/integration/spec.js-438
  // we will need to get "true" filename which in this case should be
  // cypress/integration/spec.js
  const pIndex = specFileUrl.indexOf('?p=')
  const dotJsIndex = specFileUrl.indexOf('.js-', pIndex)
  const specFile = specFileUrl.substr(pIndex + 3, dotJsIndex - pIndex)
  console.log('specFile is "%s"', specFile)

  // ignore arguments for now
  api.fromCurrentFolder = () => specFile

  // cache the fetched source, otherwise every test fetches it
  const shouldFetch = api.readFileSync === dummyReadFileSync
github bahmutov / next-update / src / registry.js View on Github external
registryUrl().then(function (npmUrl) {
    log('NPM registry url', npmUrl)
    la(check.webUrl(npmUrl), 'need npm registry url, got', npmUrl)

    npmUrl = npmUrl.replace(/^https:/, 'http:').trim()
    var url = (options.registry || npmUrl) + escapeName(name)

        // TODO how to detect if the registry is not responding?

    log('getting url', url)
    request.get(url, onNPMversions)
    var timer = setTimeout(rejectOnTimeout, MAX_WAIT_TIMEOUT)

    function onNPMversions (err, response, body) {
      log('got response for', url)
      clearTimeout(timer)

      if (err) {
        console.error('ERROR when fetching info for package', name)
github bahmutov / snap-shot / src / cypress-system.js View on Github external
function init () {
  // find out the source for all test -> this spec file
  const sites = callsites()
  la(sites.length, 'missing callsite')
  const specFileUrl = sites[1].filename
  la(is.webUrl(specFileUrl), 'missing spec url', specFileUrl)
  console.log('loading spec from', specFileUrl)

  // specFileUrl is something like
  // http://localhost:49829/__cypress/tests?p=cypress/integration/spec.js-438
  // we will need to get "true" filename which in this case should be
  // cypress/integration/spec.js
  const pIndex = specFileUrl.indexOf('?p=')
  const dotJsIndex = specFileUrl.indexOf('.js-', pIndex)
  const specFile = specFileUrl.substr(pIndex + 3, dotJsIndex - pIndex)
  console.log('specFile is "%s"', specFile)

  // ignore arguments for now
  api.fromCurrentFolder = () => specFile

  // cache the fetched source, otherwise every test fetches it
  const shouldFetch = api.readFileSync === dummyReadFileSync
github bahmutov / available-versions / src / available.js View on Github external
function formUrl (npmUrl, name) {
  la(check.unemptyString(name), 'missing name string', name)

  la(check.webUrl(npmUrl), 'need npm registry url, got', npmUrl)
  npmUrl = npmUrl.replace(/^https:/, 'http:').trim()

  // for scoped package names that have @user/foo
  var url = npmUrl + name.replace('/', '%2f')
  return url
}
github bahmutov / copi / src / copi.js View on Github external
.then(function (registry) {
      la(is.webUrl(registry.url), 'missing registry url', registry)
      la(is.object(registry.server), 'missing server itself', registry)

      return npm.install({
        name: found.name,
        flags: options.flags,
        registry: registry.url
      }).then(function () {
        debug('finished install', found.name)
        registry.server.close()
        // if (saveFlag(options.flags)) {
        //   setInstalledVersion(options.name, found.folder)
        // }
      })
    })
}
github bahmutov / available-versions / src / clean-version.js View on Github external
function clean (version, silent) {
  var originalVersion = version
  verify.unemptyString(version, 'missing version string' + version)

  if (check.webUrl(version)) {
    return
  }
  if (isKeyword(version)) {
    return
  }

  version = version.replace('~', '')
  var twoDigitVersion = /^\d+\.\d+$/
  if (twoDigitVersion.test(version)) {
    version += '.0'
  }
  if (version === 'latest' || version === '*') {
    return
  }
  try {
    version = semver.clean(version)
github bahmutov / deps-ok / src / is-supported-version-format.js View on Github external
function isSupportedVersionFormat (version) {
  la(is.unemptyString(version), 'expected version string')

  return !is.webUrl(version) &&
    !gitUrl(version) &&
    !isGitAtVersion(version) &&
    !isVersionKeyword(version) &&
    !isPrefixed(version)
}