Commit e11eddf7 authored by Dhiraj Bodicherla's avatar Dhiraj Bodicherla

Clean up unused number util method

This MR removes the recently added and unrequired
bytesToKB method
parent 7a7095fa
export const BYTES_IN_KIB = 1024; export const BYTES_IN_KIB = 1024;
export const BYTES_IN_KB = 1000;
export const HIDDEN_CLASS = 'hidden'; export const HIDDEN_CLASS = 'hidden';
export const TRUNCATE_WIDTH_DEFAULT_WIDTH = 80; export const TRUNCATE_WIDTH_DEFAULT_WIDTH = 80;
export const TRUNCATE_WIDTH_DEFAULT_FONT_SIZE = 12; export const TRUNCATE_WIDTH_DEFAULT_FONT_SIZE = 12;
......
import { BYTES_IN_KIB, BYTES_IN_KB } from './constants'; import { BYTES_IN_KIB } from './constants';
import { sprintf, __ } from '~/locale'; import { sprintf, __ } from '~/locale';
/** /**
...@@ -34,18 +34,6 @@ export function formatRelevantDigits(number) { ...@@ -34,18 +34,6 @@ export function formatRelevantDigits(number) {
return formattedNumber; return formattedNumber;
} }
/**
* Utility function that calculates KB of the given bytes.
* Note: This method calculates KiloBytes as opposed to
* Kibibytes. For Kibibytes, bytesToKiB should be used.
*
* @param {Number} number bytes
* @return {Number} KiB
*/
export function bytesToKB(number) {
return number / BYTES_IN_KB;
}
/** /**
* Utility function that calculates KiB of the given bytes. * Utility function that calculates KiB of the given bytes.
* *
......
import { import {
formatRelevantDigits, formatRelevantDigits,
bytesToKB,
bytesToKiB, bytesToKiB,
bytesToMiB, bytesToMiB,
bytesToGiB, bytesToGiB,
...@@ -55,16 +54,6 @@ describe('Number Utils', () => { ...@@ -55,16 +54,6 @@ describe('Number Utils', () => {
}); });
}); });
describe('bytesToKB', () => {
it.each`
input | output
${1000} | ${1}
${1024} | ${1.024}
`('returns $output KB for $input bytes', ({ input, output }) => {
expect(bytesToKB(input)).toBe(output);
});
});
describe('bytesToKiB', () => { describe('bytesToKiB', () => {
it('calculates KiB for the given bytes', () => { it('calculates KiB for the given bytes', () => {
expect(bytesToKiB(1024)).toEqual(1); expect(bytesToKiB(1024)).toEqual(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment