Replaced instanceof with typeof

Did some speed tests on jsperf.com, it appears the typeof check is
faster. ( http://jsperf.com/instanceof-vs-typeof2-function2). Not sure
if there are other considerations. Accuracy appears the same.

Change-Id: I0c622e33651efd57c1c17945e404a66da798095f
Reviewed-on: http://review.couchbase.org/23676
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>