const arrayUnique = (arr: any, name: any) => { var hash: any = {} return arr.reduce((acc: any, cru: any, index: any) => { if (!hash[cru[name]]) { hash[cru[name]] = { index: index } acc.push(cru) } else { acc.splice(hash[cru[name]]['index'], 1, cru) } return acc }, []) }
标签:acc,index,hash,name,cru,对象,保留,数组,any From: https://www.cnblogs.com/liiann/p/16723408.html