code: function isBoolean(value) {
  
      if (typeof(value) == "undefined") {
          return false;
      }
  
      if (typeof value === 'boolean') {
          return true;
      };
  
      var b = value.toString().trim().toLowerCase();
  
      return b === 'true' || b === 'false';
  }
docs: boolean type check.