import every from 'lodash/every' ; export function filterByDate ( line , start ? , end ? ) { const timestamp = new Date ( line . timestamp ) . getTime ( ) ; if ( start && start . getTime ( ) > timestamp ) { return true ; } if ( end && end . getTime ( ) < timestamp ) { return true ; } return false ; } export function generateFilter ( prefixes , cols ) { const indexOfCountColumn = cols . indexOf ( 'count' ) ; if ( indexOfCountColumn > - 1 ) { prefixes . splice ( indexOfCountColumn , 1 ) ; } if ( prefixes . length === 0 ) { return null ; } return ( line ) => every ( prefixes , ( prefix , i ) => ( ! prefix && prefix !== '0' ) || ( line [ i ] && line [ i ] . toString ( ) . startsWith ( prefix ) ) ) ; }