nl_tokens: Like formatSize but more generic . Returns a human - readable format of an integer using metric prefixes . The caller is expected to append any unit string if necessary .
pl_tokens: function formatCount ( n , opts ) { n = n || 0 ; opts = opts || { } ; var i = 0 , base = opts . base || 1000 , sep = opts . sep || '' , maxLen = opts . maxLen || 3 , precision = maxLen - 1 ; for ( ; n > base ; i += 1 ) { n /= base ; } if ( ! i ) { precision = 0 ; } else if ( n > 100 ) { precision -= 2 ; } else if ( n > 10 ) { precision -= 1 ; } return n . toFixed ( Math . <mask> ( 0 , precision ) ) + sep + [ '' , 'k' , 'M' , 'G' , 'T' ] [ Math . min ( i , 4 ) ] ; }