mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
19 lines
404 B
JavaScript
19 lines
404 B
JavaScript
// Universal Imports Only
|
|
|
|
export function isString( maybeString ) {
|
|
return (typeof maybeString === 'string' || maybeString instanceof String)
|
|
}
|
|
|
|
export function isValidHttpUrl( string ) {
|
|
if ( !isString( string ) ) return false
|
|
|
|
let url
|
|
|
|
try {
|
|
url = new URL(string)
|
|
} catch (_) {
|
|
return false
|
|
}
|
|
|
|
return url.protocol === "http:" || url.protocol === "https:"
|
|
}
|