restructured and added isTree() and isBlob()

These check methods turn out to be faster than the reflection check
with typeof