在开发时遇到了这个问题:
当监督内容相同时,检测 计划监督月份是否重复
const didRepeat = (array) => array.some(((hash) => ({
checkContent, month
}) => {
// 拿到内容字段、月份字段
// key 将作为唯一键值 来判断是否重复
const key = `${checkContent}_${month}`;
if (hash.has(key)) return true;
return hash.add(key), false;
})(new Set()))
// new Set 快速去重
let isTue = (didRepeat(array))