export function findCommentNode ( comment ) { const head = document . head ; for ( let i = 0 ; i < head . childNodes . length ; i ++ ) { const node = head . childNodes [ i ] ; if ( node . nodeType === 8 && node ?. nodeValue ?. trim ( ) === comment ) { return node ; } } return null ; } export function isElement ( o ) { return typeof HTMLElement === 'object' ? o instanceof HTMLElement : o && typeof o === 'object' && o !== null && o . nodeType === 1 && typeof o . nodeName === 'string' ; } export function arrayToObject ( array ) { const obj = { } ; array . forEach ( el => ( obj [ el ] = el ) ) ; return obj ; } export function createLinkElement ( attributes ) { const linkElement = document . createElement ( 'link' ) ; for ( const [ attribute , value ] of Object . entries ( attributes ) ) { if ( attribute === 'onload' ) { linkElement . onload = attributes . onload ; continue ; } linkElement [ attribute ] = value ; } return linkElement ; }