A good way to fix both null and undefined cases is as follows
const func = ({field}) => {
let subField = null;
if(field) {
({subField} = field);
}
return subField
};
If you want to handle the case when the field is undefined, you can simply
const func = ({field: {subField} = {}}) => subField;
, field undefined,