Better isFunction check.

In some browsers, `typeof /a/g` is "function" thanks to @ljharb for the suggestion.