As I am just trying to get weather its found or not found as I have mostly the code which can explain the stuff I guess
and the function form the below is
exports.verifyGroupUser = function(name) {
  const url = 'api.com'
  fetch(url)
    .then(
      function(response) {
        if (response.status !== 200) {
          console.log('Looks like there was a problem. Status Code: ' +
            response.status);
          return;
        }
        //getting list of habbo in the specific group
        response.json().then(function(data) {
          var isHabbo = ((habbo) => {
            return habbo.name === name;
          })
          var checkbname = data.find(isHabbo);
          //checkbname.then(checkbname)
          //return checkbname;
          var checkx = ((checkbname) => {
            if (checkbname == undefined) {
              return "not found"
            } else {
              return "found"
            }
          })
          console.log(checkx(checkbname)) //gives the answer i need 
          return checkx(checkbname) //gives undefined
        });
      }
    )
    .catch(function(err) {
      console.log('Fetch Error :-S', err);
    });
}
calling from another file is like
const portalcheck = require('../controllers/portalcheck')
var ans = portalcheck.verifyGroupUser(req.body.username)
                  console.log(ans)
 
    