Showing
1 changed file
with
2 additions
and
2 deletions
| ... | @@ -524,11 +524,11 @@ export function removeDuplicates(arr, keys) { | ... | @@ -524,11 +524,11 @@ export function removeDuplicates(arr, keys) { |
| 524 | * filterRepeat(arr, "name") | 524 | * filterRepeat(arr, "name") |
| 525 | */ | 525 | */ |
| 526 | export function filterRepeat(arr, key) { | 526 | export function filterRepeat(arr, key) { |
| 527 | - const duplicateIds = arr | 527 | + const newArr = arr |
| 528 | .map((item) => item[key]) | 528 | .map((item) => item[key]) |
| 529 | .filter((key, index, array) => array.indexOf(key) !== index); | 529 | .filter((key, index, array) => array.indexOf(key) !== index); |
| 530 | 530 | ||
| 531 | - return arr.filter((item) => duplicateIds.includes(item[key])); | 531 | + return arr.filter((item) => newArr.includes(item[key])); |
| 532 | } | 532 | } |
| 533 | /** | 533 | /** |
| 534 | * Array Json | 534 | * Array Json | ... | ... |
-
Please register or login to post a comment