Last active
October 24, 2024 18:03
-
-
Save artemsites/2bf93e0a6f87d187fbd34b8a8518258e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function checkArraysContainSameObjects(arr1, arr2, key) { | |
if (arr1.length !== arr2.length) { | |
return false | |
} | |
return arr1.every(arr1Obj => arr2.some(arr2Obj => arr1Obj[key] === arr2Obj[key])) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment