Are you sure `path[1]` is defined? I'm not sure. I'd do:

```
if (!path[1]) {
  return false;
}
```
And then continue with the switch