revert unneeded variable rename
This commit is contained in:
parent
ccb78ba799
commit
f2bc7f41d6
@ -27,11 +27,11 @@ function getValue(field, data) {
|
|||||||
return value[lastField] ?? null;
|
return value[lastField] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(t, transformation, rawValue) {
|
function formatValue(t, mapping, rawValue) {
|
||||||
let value = rawValue;
|
let value = rawValue;
|
||||||
|
|
||||||
// Remap the value.
|
// Remap the value.
|
||||||
const remaps = transformation?.remap ?? [];
|
const remaps = mapping?.remap ?? [];
|
||||||
for (let i = 0; i < remaps.length; i += 1) {
|
for (let i = 0; i < remaps.length; i += 1) {
|
||||||
const remap = remaps[i];
|
const remap = remaps[i];
|
||||||
if (remap?.any || remap?.value === value) {
|
if (remap?.any || remap?.value === value) {
|
||||||
@ -42,7 +42,7 @@ function formatValue(t, transformation, 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 = transformation?.scale;
|
const scale = mapping?.scale;
|
||||||
if (typeof scale === "number") {
|
if (typeof scale === "number") {
|
||||||
value *= scale;
|
value *= scale;
|
||||||
} else if (typeof scale === "string") {
|
} else if (typeof scale === "string") {
|
||||||
@ -53,7 +53,7 @@ function formatValue(t, transformation, rawValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Format the value using a known type.
|
// Format the value using a known type.
|
||||||
switch (transformation?.format) {
|
switch (mapping?.format) {
|
||||||
case "number":
|
case "number":
|
||||||
value = t("common.number", { value: parseInt(value, 10) });
|
value = t("common.number", { value: parseInt(value, 10) });
|
||||||
break;
|
break;
|
||||||
@ -72,17 +72,17 @@ function formatValue(t, transformation, rawValue) {
|
|||||||
case "date":
|
case "date":
|
||||||
value = t("common.date", {
|
value = t("common.date", {
|
||||||
value,
|
value,
|
||||||
lng: transformation?.locale,
|
lng: mapping?.locale,
|
||||||
dateStyle: transformation?.dateStyle ?? "long",
|
dateStyle: mapping?.dateStyle ?? "long",
|
||||||
timeStyle: transformation?.timeStyle,
|
timeStyle: mapping?.timeStyle,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "relativeDate":
|
case "relativeDate":
|
||||||
value = t("common.relativeDate", {
|
value = t("common.relativeDate", {
|
||||||
value,
|
value,
|
||||||
lng: transformation?.locale,
|
lng: mapping?.locale,
|
||||||
style: transformation?.style,
|
style: mapping?.style,
|
||||||
numeric: transformation?.numeric,
|
numeric: mapping?.numeric,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "text":
|
case "text":
|
||||||
@ -91,13 +91,13 @@ function formatValue(t, transformation, rawValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply fixed prefix.
|
// Apply fixed prefix.
|
||||||
const prefix = transformation?.prefix;
|
const prefix = mapping?.prefix;
|
||||||
if (prefix) {
|
if (prefix) {
|
||||||
value = `${prefix} ${value}`;
|
value = `${prefix} ${value}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply fixed suffix.
|
// Apply fixed suffix.
|
||||||
const suffix = transformation?.suffix;
|
const suffix = mapping?.suffix;
|
||||||
if (suffix) {
|
if (suffix) {
|
||||||
value = `${value} ${suffix}`;
|
value = `${value} ${suffix}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user