@pitcher/canvas-ui 2026.1.7-91220 → 2026.1.7-95151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/canvas-ui.js +13 -10
- package/canvas-ui.js.map +1 -1
- package/package.json +1 -1
package/canvas-ui.js
CHANGED
|
@@ -131649,21 +131649,24 @@ const displayIntegerWithMunit = (number, decimals = 2) => {
|
|
|
131649
131649
|
return `${b.toFixed(decimals)}B`;
|
|
131650
131650
|
};
|
|
131651
131651
|
const convertSecondsToMinutes = (number) => {
|
|
131652
|
+
if (number <= 0) return "0 sec";
|
|
131653
|
+
if (number < 1) return "<1 sec";
|
|
131652
131654
|
const units = [
|
|
131653
|
-
[
|
|
131654
|
-
[60, "min"],
|
|
131655
|
+
[60 * 60 * 24, "day"],
|
|
131655
131656
|
[60 * 60, "h"],
|
|
131656
|
-
[60
|
|
131657
|
+
[60, "min"],
|
|
131658
|
+
[1, "sec"]
|
|
131657
131659
|
];
|
|
131658
|
-
|
|
131659
|
-
|
|
131660
|
-
|
|
131661
|
-
|
|
131660
|
+
const parts = [];
|
|
131661
|
+
let remaining = number;
|
|
131662
|
+
for (const [divisor, label] of units) {
|
|
131663
|
+
if (remaining >= divisor) {
|
|
131664
|
+
const val = Math.floor(remaining / divisor);
|
|
131665
|
+
parts.push(`${val} ${label}`);
|
|
131666
|
+
remaining = remaining % divisor;
|
|
131662
131667
|
}
|
|
131663
131668
|
}
|
|
131664
|
-
|
|
131665
|
-
const val = Math.floor(number / Number(divisor));
|
|
131666
|
-
return `${val} ${label}`;
|
|
131669
|
+
return parts.slice(0, 2).join(" ");
|
|
131667
131670
|
};
|
|
131668
131671
|
const getNumberWithRegex = (string) => {
|
|
131669
131672
|
return string?.replace(/\D+/g, "");
|