const ABSOLUTE_HTTP = /^https?:\/\/[\w.-]+(?:\/[\w\-./?%&=]*)?$/i

export function isAbsoluteHttpUrl(target) {
	return typeof target === 'string' && ABSOLUTE_HTTP.test(target)
}

export function trimTrailingSlash(apiRoot) {
	return String(apiRoot).replace(/\/$/, '')
}
