Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e11eddf7
Commit
e11eddf7
authored
Oct 14, 2020
by
Dhiraj Bodicherla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up unused number util method
This MR removes the recently added and unrequired bytesToKB method
parent
7a7095fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
25 deletions
+1
-25
app/assets/javascripts/lib/utils/constants.js
app/assets/javascripts/lib/utils/constants.js
+0
-1
app/assets/javascripts/lib/utils/number_utils.js
app/assets/javascripts/lib/utils/number_utils.js
+1
-13
spec/frontend/lib/utils/number_utility_spec.js
spec/frontend/lib/utils/number_utility_spec.js
+0
-11
No files found.
app/assets/javascripts/lib/utils/constants.js
View file @
e11eddf7
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
;
...
...
app/assets/javascripts/lib/utils/number_utils.js
View file @
e11eddf7
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.
*
*
...
...
spec/frontend/lib/utils/number_utility_spec.js
View file @
e11eddf7
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment