export const compare =(po)=>{
	return function(a,b){
		let temp1 = a[po];
		let temp2 = b[po];
		return temp1-temp2
	}
}
export const singel = (arr)=>{
  	let obj = {};
  	arr = arr.reduce(function(item, next) {
       obj[next.id] ? '' : obj[next.id] = true && item.push(next);
       return item;
    }, []);
    return arr
}

export const getAutioLength = (message)=>{
    for(let m of message){
      if(m.type==34){
        let mp3 = process.env.IMG_ADDRESS + m.audioUrl;
        let mp3Temp = new Audio(mp3);
        m.duration = mp3Temp.duration
      }
    }
    return message
}
