MCPcopy
hub / github.com/ThatGuySam/doesitarm / isValidImageUrl

Function isValidImageUrl

helpers/check-types.js:44–52  ·  view source on GitHub ↗
( maybeUrl )

Source from the content-addressed store, hash-verified

42}
43
44export function isValidImageUrl ( maybeUrl ) {
45 if ( !isValidHttpUrl( maybeUrl ) ) return false
46
47 // Check if url has a file extension
48 const url = new URL(maybeUrl)
49 const fileExtension = url.pathname.split('.').pop()
50
51 return isNonEmptyString( fileExtension )
52}
53
54
55export function isObject( maybeObject ) {

Callers

nothing calls this directly

Calls 2

isValidHttpUrlFunction · 0.85
isNonEmptyStringFunction · 0.85

Tested by

no test coverage detected