import * as useragent from 'express-useragent' ; import * as http from 'http' ; export function isDesktop ( req ) { let userAgent = '' ; if ( req ) { userAgent = req . headers [ 'user-agent' ] ; } else if ( typeof window !== 'undefined' ) { userAgent = window . navigator . userAgent ; } return useragent . parse ( userAgent ) . isDesktop ; }