code: function gettype(obj) {
    var type = typeof obj;
  
    if (type !== 'object') {
      return type;
    }
  
    // inspect [[Class]] for objects
    return toString.call(obj)
      .replace(objectRegExp, '$1');
  }
docs: get type for error message