mirror of https://github.com/gorhill/uBlock.git
Minor code review
This commit is contained in:
parent
789ee8d910
commit
c5baa8808b
|
@ -28,28 +28,21 @@ import µb from './background.js';
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
µb.formatCount = function(count) {
|
µb.formatCount = function(count) {
|
||||||
if ( typeof count !== 'number' ) {
|
if ( typeof count !== 'number' ) { return ''; }
|
||||||
return '';
|
const s = `${count}`;
|
||||||
|
if ( count < 1000 ) { return s; }
|
||||||
|
if ( count < 10000 ) {
|
||||||
|
return '>' + s.slice(0,1) + 'k';
|
||||||
}
|
}
|
||||||
let s = count.toFixed(0);
|
if ( count < 100000 ) {
|
||||||
if ( count >= 1000 ) {
|
return s.slice(0,2) + 'k';
|
||||||
if ( count < 10000 ) {
|
|
||||||
s = '>' + s.slice(0,1) + 'k';
|
|
||||||
} else if ( count < 100000 ) {
|
|
||||||
s = s.slice(0,2) + 'k';
|
|
||||||
} else if ( count < 1000000 ) {
|
|
||||||
s = s.slice(0,3) + 'k';
|
|
||||||
} else if ( count < 10000000 ) {
|
|
||||||
s = s.slice(0,1) + 'M';
|
|
||||||
} else {
|
|
||||||
s = s.slice(0,-6) + 'M';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return s;
|
if ( count < 1000000 ) {
|
||||||
|
return s.slice(0,3) + 'k';
|
||||||
|
}
|
||||||
|
return s.slice(0,-6) + 'M';
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://www.youtube.com/watch?v=DyvzfyqYm_s
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
µb.dateNowToSensibleString = function() {
|
µb.dateNowToSensibleString = function() {
|
||||||
|
|
Loading…
Reference in New Issue