vendredi 20 décembre 2019

validate parameter when is null or different

I have a parameter that is looking like reg.headers["my-parameter"] and this can be empty or different like reg.headers["other-parameter"]. The problem is in both cases is returning undefind, my question is how can I diferenciate this situation and to know when is null and when is wrong.

tryed something like:

 if (!reg.header["my-parameter") {
      callThisFunction();
    } else if (reg.header["my-parameter" === undefined) {
      callOtherFunction();
}

Aucun commentaire:

Enregistrer un commentaire