export function intervalToMs ( interval ) { const [ , valueAsString , unit ] = String ( interval ) . split ( /(.*)(s|m|h|d|w)/ ) ; const value = Number ( valueAsString ) ; switch ( unit ) { case 's' : return value * 1000 ; case 'm' : return value * 1000 * 60 ; case 'h' : return value * 1000 * 60 * 60 ; case 'd' : return value * 1000 * 60 * 60 * 24 ; case 'w' : return value * 1000 * 60 * 60 * 24 * 7 ; } throw new Error ( 'Could not parse interval' ) ; }