const obj = {
name: 'name',
id: '123',
условие ?? (IADDRESS_LEVELID: '456')
};
this.selectedNodesInfo = selectedItems.map(({ id, IADDRESS_LEVELID, [fieldName]: name }) => {
const result = { name: name ?? id, id };
if (this.isAddress) {
result.IADDRESS_LEVELID = IADDRESS_LEVELID;
}
return result;
});
this.selectedNodesInfo = selectedItems.map(({ id, IADDRESS_LEVELID, [fieldName]: name }) => ({
name: name ?? id,
id,
...(this.isAddress ? { IADDRESS_LEVELID } : null),
}));