A good practice is to test for a var to be an object before processing its properties:

```js
selectorFunction = options && options.selectorFunction;
```