I don't know how to make this code shorter, there are many other values I need to check and track change, so the code gets big and complicated
doc.name = doc.name === offer.title
? doc.name
: () => {
shouldUpdate = true ;
return offer.title
};
doc.uri = doc.uri
? doc.uri
: () => {
shouldUpdate = true;
return encodeURI(offer.title)
};
doc.info = doc.info
? doc.info
: () => {
shouldUpdate = true;
return {
activation: offer.activation,
image: offer.image
};
};