/**
- Created by chj on 2018/6/12.
*/
/**
arr:對象數(shù)組
根據(jù)對象的某一個(gè) key 進(jìn)行去重(確保key的唯一性)
-
*/
const arrayUnique = (arr, key)=>{
let hash = {};
return arr.reduce((item, next)=>{
// hash[next[key]] ? '' : hash[next[key]] = true && item.push(next);if (hash[next[key]]){ }else { hash[next[key]] = true ; item.push(next); } return item;}, []);
};
export default {
arrayUnique
}