Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/router / src / deps / checks.ts
Size: Mime:
import { isObj, isBrowser, isString, EMPTY_STRING } from 'exotic'

// const matchProtocol = /^(?:[a-z]+:)?/
const matchProtocol = /^(?:[a-z]+:)/
const hasProtocol = (x: string) => matchProtocol.test(x)

function isFullyQualifiedWebAddress(address: string): boolean {
  return hasProtocol(address)
}

/**
 * @TODO isInOurRoutes
 */
function isRelativeWebAddress(address: string): string {
  return address
}
function isStringifiedParams(x: string): boolean {
  if (!isString(x)) {
    return false
  } else if (x.includes('=')) {
    return true
  } else if (x.startsWith('?')) {
    return true
  } else if (x.startsWith('#')) {
    return true
  } else {
    return false
  }
}

const isHash = (to: any): to is string => isString(to) && to.startsWith('#')

export {
  isRelativeWebAddress,
  isFullyQualifiedWebAddress,
  hasProtocol,
  isHash,
  isStringifiedParams,
}