this is problematic. val can be 0, empty string or undefined.

it should be

```js
if (val === null) return null;
```