Repository URL to install this package:
|
Version:
5.0.1 ▾
|
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,
}