From 8cfbe8c67d93c572ad2e2467f32366e2f1471b02 Mon Sep 17 00:00:00 2001 From: BlazeInferno64 <96913755+BlazeInferno64@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:50:06 +0530 Subject: [PATCH] Delete src/utils/math.js --- src/utils/math.js | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 src/utils/math.js diff --git a/src/utils/math.js b/src/utils/math.js deleted file mode 100644 index 151bb96..0000000 --- a/src/utils/math.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2025 BlazeInferno64 --> https://github.com/blazeinferno64. -// -// Author(s) -> BlazeInferno64 -// -// Last updated: 02/01/2025 - -"use strict"; - -/** - * Util tool for processing given bytes into a properly formatted byte string - * - * @param {number} bytes - The bytes which you would like to format. - * @returns {string} A formatted byte string which eg 0 Bytes, 128KB, etc. - */ -const formatBytes = (bytes) => { - if (bytes < 0) return "Invalid byte size"; // Handle negative values - if (bytes === 0) return "0 Bytes"; // Handle zero bytes - const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; // Upto yettabytes - const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); - return `${(bytes / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`; -} - -/** - * Util tool for processing given ms into a properly formatted seconds string - * - * @param {number} ms - The ms which you would like to format. - * @returns {string} A formatted seconds string which eg 2s, 4s, etc. - */ -const format_MS_to_S = (ms) => { - if (ms < 0) return "Invalid milliseconds size!"; - if (ms === 0) return "0 s"; - const seconds = (ms / 1000); - return `${seconds} s`; -} - -module.exports = { - formatBytes, - format_MS_to_S -} \ No newline at end of file