Intermediate Algorithm Scripting:Pig Latin Challenge

Hello, I am doing the Pig Latin challenge and it is giving me an error.
It says that it should handle words without vowels.
This is my code:

function translatePigLatin(str) {
  var patt = new RegExp("\[aeiou]+");
 
  
  if(str[0].match(patt)){
    return str+'way';
  }else if(!str.match(patt)) {
   
     var index=str.indexOf(str.match(patt));
     return str.substr(index)+str.substr(0, index)+"ay";
    
  }
  
}