In my express server I have a function that if a request body is passed to it, it destructures the properties from it as so:
export function createProxiedRequestBody({ dateRange, dateFrom, filters },
dateDefault) {
}
Its a common function where the object passed to it could be void but is obviously causing errors as such:
Cannot read property 'dateRange' of null.
Is there a fancy JavaScript way I can ignore these in the parameters rather than writing an if block statement in the function ?