lint: var to let/const

This commit is contained in:
xenticore
2025-04-24 17:38:02 -04:00
parent d71cfcd0d7
commit df3b40fbdd
11 changed files with 44 additions and 45 deletions

View File

@@ -2,14 +2,14 @@ import { conversion_ref_usd } from '../config';
import { $T } from './localization'
function toFixed(num: number, fixed: number) {
var re = new RegExp('^-?\\d+(?:\.\\d{0,' + (fixed || -1) + '})?');
const re = new RegExp('^-?\\d+(?:\.\\d{0,' + (fixed || -1) + '})?');
return num.toString().match(re)[0];
}
export function formatPrice(keys: number, metal: number, keyPrice: number, locale: string = 'en') {
const formattedKeys = +(keys + (metal / keyPrice)).toFixed(2)
var output: string = ''
let output: string = ''
if(keys > 0) {
output += (formattedKeys == 1.0 ? $T("%@ key") : $T("%@ keys")).replace('%@', formattedKeys.toLocaleString(locale))
} else {

View File

@@ -30,7 +30,7 @@ export function $T(s: string, locale?: Intl.LocalesArgument): string {
}
export function extractLocaleFromURL(url: string): string {
var split = url.substring(url.indexOf("/wiki/") + "/wiki/".length);
const split = url.substring(url.indexOf("/wiki/") + "/wiki/".length);
if (split.indexOf('/') != -1) {
// Remove language suffix e.g. `/es`
return split.substring(split.indexOf('/') + 1);

View File

@@ -1,5 +1,4 @@
declare var __PRODUCTION: boolean;
declare var __EXTENSION_NAME: string;
declare let __EXTENSION_NAME: string;
const logHeader = `[${__EXTENSION_NAME}] `;
/** `console.debug` with header; automatically NO-OP on production build */

View File

@@ -1,5 +1,5 @@
export function extractPageTitleFromURL(url: string): string {
var split = url.substring(url.indexOf("/wiki/") + "/wiki/".length);
let split = url.substring(url.indexOf("/wiki/") + "/wiki/".length);
if (split.indexOf('/') != -1) {
// Remove language suffix (/es)
split = split.substring(0, split.indexOf('/'));