I have below javascript object and wanted to some property based on conditionally. If the type is not match then don't include those property in object. Don't wanted to set null or undefined conditionally to start and end property. Just wanted to remove.
let startDate = "02/03/2021";
let endDate = "03/03/2021";
const update = (type, value) => {
//wanted to exclude start and end property from below object other than type "today".
//Don't wanted to set null or undefined conditionally to start and end property. Just wanted to remove
updateDate({
start: startDate,
end: endDate,
type: type === "today" ? "TD" : type,
value: value === "today" ? "TD" : value
})
}