Move CFG to top level for shorter access, add hacky jsdoc typedef

This commit is contained in:
DominikDoom
2025-07-10 18:22:18 +02:00
parent bdbda299f7
commit 8eb5176ab4
12 changed files with 218 additions and 169 deletions

View File

@@ -259,13 +259,13 @@ class TacUtils {
*/
static calculateUsageBias(result, count, uses) {
// Check setting conditions
if (uses < TAC.Globals.CFG.frequencyMinCount) {
if (uses < TAC.CFG.frequencyMinCount) {
uses = 0;
} else if (uses != 0) {
result.usageBias = true;
}
switch (TAC.Globals.CFG.frequencyFunction) {
switch (TAC.CFG.frequencyFunction) {
case "Logarithmic (weak)":
return Math.log(1 + count) + Math.log(1 + uses);
case "Logarithmic (strong)":
@@ -492,7 +492,7 @@ class TacUtils {
* @returns {((a: any, b: any) => number)}
*/
static getSortFunction() {
let criterion = TAC.Globals.CFG.modelSortOrder || "Name";
let criterion = TAC.CFG.modelSortOrder || "Name";
const textSort = (a, b, reverse = false) => {
// Assign keys so next sort is faster