Skip to content

Instantly share code, notes, and snippets.

@valeriocs
Created December 13, 2018 12:52
Show Gist options
  • Save valeriocs/6adf0d0e7034ed72f1910a2765fccd2d to your computer and use it in GitHub Desktop.
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.
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