docs: function __typeCheck(type, valueToCheck, optional) {
      var correct = typeof(valueToCheck) == type;
      if(optional) {
          // Exception if the variable is optional, than it also may be undefined or null
          correct = correct || valueToCheck === undefined || valueToCheck === null;
      }
      if(!correct) {
          throw new Error("Invalid argument type received; expected "+type+
              ", but received "+typeof(valueToCheck));
      }
  }