Parameter Validation

Validating the parameter passed in the functions are used to check whether the parameter is null or has a value

  * Defines the function to check the validation of each parameter.

     * @param {string|number}} parameter

     * @returns {boolean}

     */

                const checkForParameter = function checkForParameter(parameter) {

                        try {

                                if (parameter !== “” && parameter !== null && parameter !== undefined && parameter !== false && parameter !== “null” && parameter !== “undefined” && parameter !== ” “ && parameter !== ‘false’ && parameter !== 0 && parameter !== ‘0’) {

                                        return true;

                                }

                                else {

                                        return false;

                                }

                        }

                        catch (err) {

                                log.error(“error@checkParameter”, err);

                                return true;

                        }

                }

This helps us to analyze the whether the function is executed or not with the help of the parameter

Leave a comment

Your email address will not be published. Required fields are marked *