Optimize isFunction only when appropriate.

Closes #1929.

@jdalton: How did you test this? Seems PhantomJS doesn't play nicely with `typeof` or `toString.call` (returning `object` and `[object Int8ArrayConstructor]`).
That won't work in older environments or `nodejs`

```
toString(Uint8Array) // '[object Undefined]'
({}).toString.call(Uint8Array) // '[object Function]'
```