(array, compare)
| 860 | |
| 861 | // 数组去重 |
| 862 | unique(array, compare) { |
| 863 | let hash = {}; |
| 864 | let arr = array.reduce(function(item, next) { |
| 865 | hash[next[compare]] ? '' : (hash[next[compare]] = true && item.push(next)); |
| 866 | // console.log('item',item.project_id) |
| 867 | return item; |
| 868 | }, []); |
| 869 | // 输出去重以后的project_id |
| 870 | return arr.map(item => { |
| 871 | return item[compare]; |
| 872 | }); |
| 873 | } |
| 874 | } |
| 875 | |
| 876 | module.exports = interfaceColController; |
no outgoing calls
no test coverage detected