src/utils/validation.js
/**
   *  @description method for validation of create contact input
   *  @param {object} data body of the user's request
   *  @returns {object} The body of  the response message
   */
@description method for validation of create contact input
@param {object} data body of the user's request
@returns {object} The body of  the response message
@description method for validation of create contact input @param { object } data body of the user ' s request @returns { object } The body of the response message
static validateCreateContact(data) {
    const error = {};
    data.name = data.name ? data.name : '';
    data.phoneNumber = data.phoneNumber ? data.phoneNumber : '';
    if (!(data.name)) {
      error.name = 'Please enter a valid contact name';
    }
    if (!(data.phoneNumber)) {
      error.email = 'Please enter a phone number';
    }
    return {
      error,
      isValid: isEmpty(error),
      status: 'error'
    };
  }
static validateCreateContact ( data ) { const error = { } ; data . name = data . name ? data . name : '' ; data . phoneNumber = data . phoneNumber ? data . phoneNumber : '' ; if ( ! ( data . name ) ) { error . name = 'Please enter a valid contact name' ; } if ( ! ( data . phoneNumber ) ) { error . email = 'Please enter a phone number' ; } return { error , isValid : isEmpty ( error ) , status : 'error' } ; }
@description method for validation of create contact input
  @param {object} data body of the user's request
  @returns {object} The body of  the response message
@description method for validation of create contact input @param { object } data body of the user ' s request @returns { object } The body of the response message