You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
328 B
11 lines
328 B
const formatHashrate = hashrate => ['H', 'KH', 'MH', 'GH', 'TH', 'PH'].reduce((previous, unit, exponent) => {
|
|
const devisor = (1000 ** exponent);
|
|
if (hashrate > devisor) {
|
|
const value = Math.floor(hashrate / devisor);
|
|
return `${value.toLocaleString()} ${unit}/s`;
|
|
}
|
|
|
|
return previous;
|
|
});
|
|
|
|
export default formatHashrate;
|
|
|