var is_has = function (text,val) {
  if(text.indexOf(","+val+",")==-1) return false;
  return true
}

function get_guige(color,spece){
	 if(color=="" && spece==""){return "规格1"}
	 if(spece!="" &&  color==""){return spece}
	 if(spece=="" &&  color!=""){return color}
	 if(spece!="" &&  color!=""){return spece+"/"+color}
	 return "";
}

function get_color(index,list){
   var i=index+1;
   var count=list.length;	   
   var str="purple";	
   i=index%count;
   switch(i){
      case 1: str="red";
      case 2: str="blue";    
   }
   return str;
}

module.exports = {
  is_has: is_has,
  get_guige:get_guige,
  get_color:get_color
}
