Fix lint issues.
This commit is contained in:
parent
d0665d309f
commit
ea69e3b709
@ -28,13 +28,13 @@ function getValue(field, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(t, mapping, rawValue) {
|
function formatValue(t, mapping, rawValue) {
|
||||||
var value = rawValue;
|
let value = rawValue;
|
||||||
|
|
||||||
// Remap the value.
|
// Remap the value.
|
||||||
const remaps = mapping?.remap ?? [];
|
const remaps = mapping?.remap ?? [];
|
||||||
for (let i = 0; i < remaps.length; i++) {
|
for (let i = 0; i < remaps.length; i += 1) {
|
||||||
let remap = remaps[i];
|
const remap = remaps[i];
|
||||||
if (remap?.any || remap?.value == value) {
|
if (remap?.any || remap?.value === value) {
|
||||||
value = remap.to;
|
value = remap.to;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -43,12 +43,12 @@ function formatValue(t, mapping, rawValue) {
|
|||||||
// Scale the value. Accepts either a number to multiply by or a string
|
// Scale the value. Accepts either a number to multiply by or a string
|
||||||
// like "12/345".
|
// like "12/345".
|
||||||
const scale = mapping?.scale;
|
const scale = mapping?.scale;
|
||||||
if (typeof scale == 'number') {
|
if (typeof scale === 'number') {
|
||||||
value = value * scale;
|
value *= scale;
|
||||||
} else if (typeof scale == 'string') {
|
} else if (typeof scale === 'string') {
|
||||||
let parts = scale.split('/');
|
const parts = scale.split('/');
|
||||||
let numerator = parts[0] ? parseFloat(parts[0]) : 1;
|
const numerator = parts[0] ? parseFloat(parts[0]) : 1;
|
||||||
let denominator = parts[1] ? parseFloat(parts[1]) : 1;
|
const denominator = parts[1] ? parseFloat(parts[1]) : 1;
|
||||||
value = value * numerator / denominator;
|
value = value * numerator / denominator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,12 +69,15 @@ function formatValue(t, mapping, rawValue) {
|
|||||||
case 'bitrate':
|
case 'bitrate':
|
||||||
value = t("common.bitrate", { value });
|
value = t("common.bitrate", { value });
|
||||||
break;
|
break;
|
||||||
|
case 'text':
|
||||||
|
default:
|
||||||
|
// nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply fixed suffix.
|
// Apply fixed suffix.
|
||||||
const suffix = mapping?.suffix;
|
const suffix = mapping?.suffix;
|
||||||
if (suffix) {
|
if (suffix) {
|
||||||
value = value + ' ' + suffix;
|
value = `${value} ${suffix}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user