import config from './config' ; import { SubscriberStats } from '../../types/opentok/subscriber' ; import { getOr , last } from '../../util' ; export default function getLatestSampleWindow ( stats ) { const mostRecentTimestamp = getOr ( 0 , 'timestamp' , last ( stats ) ) ; const oldestAllowedTime = mostRecentTimestamp - config . steadyStateSampleWindow ; return stats . filter ( ( stat ) => stat . timestamp >= oldestAllowedTime ) ; }