Refactor out Setting.getDeduplicatedArray()

This commit is contained in:
Yang Luo
2021-07-09 23:12:13 +08:00
parent 1bfddc5d53
commit 4a0f22355e
3 changed files with 19 additions and 12 deletions

View File

@ -453,3 +453,8 @@ export function getArrayItem(array, key, value) {
const res = array.filter(item => item[key] === value)[0];
return res;
}
export function getDeduplicatedArray(array, filterArray, key) {
const res = array.filter(item => filterArray.filter(filterItem => filterItem[key] === item[key]).length === 0);
return res;
}