Hmm, on the other hand.. Maybe something more like

```js
if (!key1) return pathVal;
else if (pathVal == null) return undefined;
```

might be cleaner / easier to read, and possibly save a comparison.

I contradict myself a lot, you'll get used to it ;) I just want to avoid duplicating code, and try to keep it readable and straight forward