Created
December 13, 2018 12:52
-
-
Save valeriocs/6adf0d0e7034ed72f1910a2765fccd2d to your computer and use it in GitHub Desktop.
Returns true if the selected array item value is the same through all array.
This file contains hidden or 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
allAreSame() { | |
if (this.array.length) return; | |
const paramToCompare = this.array[0].key; | |
const comparation = this.array | |
.every(({ correspondingKey }) => correspondingKey === paramToCompare); | |
return comparation; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment