feat: refactor settings

This commit is contained in:
Fredrik Burmester
2025-01-02 16:49:04 +01:00
parent 5333d53d61
commit 07c7cb7ab5
21 changed files with 1405 additions and 1103 deletions

View File

@@ -1,9 +1,9 @@
declare global {
interface Number {
bytesToReadable(): string;
secondsToMilliseconds(): number
minutesToMilliseconds(): number
hoursToMilliseconds(): number
secondsToMilliseconds(): number;
minutesToMilliseconds(): number;
hoursToMilliseconds(): number;
}
}
@@ -11,27 +11,27 @@ Number.prototype.bytesToReadable = function () {
const bytes = this.valueOf();
const gb = bytes / 1e9;
if (gb >= 1) return `${gb.toFixed(2)} GB`;
if (gb >= 1) return `${gb.toFixed(0)} GB`;
const mb = bytes / 1024.0 / 1024.0;
if (mb >= 1) return `${mb.toFixed(2)} MB`;
if (mb >= 1) return `${mb.toFixed(0)} MB`;
const kb = bytes / 1024.0;
if (kb >= 1) return `${kb.toFixed(2)} KB`;
if (kb >= 1) return `${kb.toFixed(0)} KB`;
return `${bytes.toFixed(2)} B`;
}
};
Number.prototype.secondsToMilliseconds = function () {
return this.valueOf() * 1000
}
return this.valueOf() * 1000;
};
Number.prototype.minutesToMilliseconds = function () {
return this.valueOf() * (60).secondsToMilliseconds()
}
return this.valueOf() * (60).secondsToMilliseconds();
};
Number.prototype.hoursToMilliseconds = function () {
return this.valueOf() * (60).minutesToMilliseconds()
}
return this.valueOf() * (60).minutesToMilliseconds();
};
export {};
export {};