export function noop ( ) { } export function partition < T > ( arr , fn ) { const left = [ ] ; const right = [ ] ; for ( const item of arr ) { fn ( item ) ? left . push ( item ) : right . push ( item ) ; } return [ left , right ] ; } export function formatTraffic ( num ) { const s = [ 'B' , 'KB' , 'MB' , 'GB' , 'TB' ] ; let idx = 0 ; while ( ~ ~ ( num / 1024 ) && idx < s . length ) { num /= 1024 ; idx ++ ; } return `${ idx === 0 ? num : num . toFixed ( 2 ) } ${ s [ idx ] }` ; }