I encountered the following code snippet:
const calcRowCssClasses = (<string[]>context.dataItem.cssClasses).map(
(cssClass) => {
return { [cssClass]: true };
}
);
This code block generates an array of objects like this:
{ "custom-calcrow-1": true },
{ "custom-calcrow-2": true }
Now, I have a base object structured as follows:
{ "calcrow": true}
The main question here is how can I append the above two entries to the existing object so that the final output will look like this:
{
"calcrow": true,
"custom-calcrow-1": true,
"custom-calcrow-2": true
}
Essentially, my goal is to merge an array of objects into one. However, using the current approach such as
return { calcrow: true, ...calcRowCssClasses };
results in:
0: {custom-calcrow-1: true},
1: {custom-calcrow-2: true},
calcrow: true
This outcome does not align with the desired expectation.
Your input and guidance are appreciated.Thank you!