Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
timonson committed Mar 16, 2024
1 parent c6bcb8c commit 9272bc2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions units.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* @const
* @type {number}
*/
export const BYTES_PER_KB = 1024;
export const bytesPerKb = 1024;

/**
* Convert bytes to megabytes.
* @param {number} bytes - The number of bytes.
* @return {number} The equivalent number of megabytes.
*/
export function bytesToMb(bytes) {
return bytes / BYTES_PER_KB / BYTES_PER_KB;
return bytes / bytesPerKb / bytesPerKb;
}

/**
Expand All @@ -20,7 +20,7 @@ export function bytesToMb(bytes) {
* @return {number} The equivalent number of gigabytes.
*/
export function bytesToGb(bytes) {
return bytes / BYTES_PER_KB / BYTES_PER_KB / BYTES_PER_KB;
return bytes / bytesPerKb / bytesPerKb / bytesPerKb;
}

/**
Expand All @@ -29,7 +29,7 @@ export function bytesToGb(bytes) {
* @return {number} The equivalent number of bytes.
*/
export function mbToBytes(mb) {
return mb * BYTES_PER_KB * BYTES_PER_KB;
return mb * bytesPerKb * bytesPerKb;
}

/**
Expand All @@ -38,7 +38,7 @@ export function mbToBytes(mb) {
* @return {number} The equivalent number of gigabytes.
*/
export function mbToGb(mb) {
return mb / BYTES_PER_KB;
return mb / bytesPerKb;
}

/**
Expand All @@ -47,7 +47,7 @@ export function mbToGb(mb) {
* @return {number} The equivalent number of bytes.
*/
export function gbToBytes(gb) {
return gb * BYTES_PER_KB * BYTES_PER_KB * BYTES_PER_KB;
return gb * bytesPerKb * bytesPerKb * bytesPerKb;
}

/**
Expand All @@ -56,5 +56,5 @@ export function gbToBytes(gb) {
* @return {number} The equivalent number of megabytes.
*/
export function gbToMb(gb) {
return gb * BYTES_PER_KB;
return gb * bytesPerKb;
}

0 comments on commit 9272bc2

Please sign in to comment.