Commit 2cf100d5 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'cleanup-number-util-method' into 'master'

Remove unused number util method

See merge request gitlab-org/gitlab!45220
parents 8771610f e11eddf7
export const BYTES_IN_KIB = 1024;
export const BYTES_IN_KB = 1000;
export const HIDDEN_CLASS = 'hidden';
export const TRUNCATE_WIDTH_DEFAULT_WIDTH = 80;
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';
/**
......@@ -34,18 +34,6 @@ export function formatRelevantDigits(number) {
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.
*
......
import {
formatRelevantDigits,
bytesToKB,
bytesToKiB,
bytesToMiB,
bytesToGiB,
......@@ -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', () => {
it('calculates KiB for the given bytes', () => {
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