UI: Fixed flatDataWithoutOverride - create empty object when data array is empty.
This commit is contained in:
parent
e03994c2ea
commit
b96d3d02ac
@ -478,16 +478,16 @@ export function flatFormattedData(input: FormattedData[]): FormattedData {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function flatDataWithoutOverride(data: FormattedData[]): FormattedData {
|
export function flatDataWithoutOverride(input: FormattedData[]): FormattedData {
|
||||||
const processingKeyValue = data[0];
|
const result: FormattedData = {} as FormattedData;
|
||||||
for (let i = 1; i < data.length; i++) {
|
input.forEach((data) => {
|
||||||
Object.keys(data[i]).forEach((key) => {
|
Object.keys(data).forEach((key) => {
|
||||||
if (!isDefinedAndNotNull(processingKeyValue[key]) || isEmptyStr(processingKeyValue[key])) {
|
if (!isDefinedAndNotNull(result[key]) || isEmptyStr(result[key])) {
|
||||||
processingKeyValue[key] = data[i][key];
|
result[key] = data[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
return processingKeyValue;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mergeFormattedData(first: FormattedData[], second: FormattedData[]): FormattedData[] {
|
export function mergeFormattedData(first: FormattedData[], second: FormattedData[]): FormattedData[] {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user