import { ParsedUrlQuery } from 'querystring' ; param maybeString export function parseNumber ( maybeString ? ) { if ( maybeString ) { if ( Array . isArray ( maybeString ) ) { const [ num ] = maybeString ; return Number ( num ) ; } return Number ( maybeString ) ; } return undefined ; } param maybeString export function parseString ( maybeString ? ) { if ( maybeString ) { if ( Array . isArray ( maybeString ) ) { const [ string ] = maybeString ; return string ; } return maybeString ; } return undefined ; } export function parseStreamTimeQuery ( query ) { const { startH , startM } = query ; return { startH : parseNumber ( startH ) ?? 21 , startM : parseNumber ( startM ) ?? 0 , } ; } export function parseTimeSignalQuery ( query ) { const { h , m } = query ; return { h : parseNumber ( h ) ?? 21 , m : parseNumber ( m ) ?? 0 , } ; }