I have an array of contact objects that all of an isPrimary property. Only one of them should be true, but regardless I would like to sort any primary contacts to the top of the array. I'm using VueJS and plan to do this on created in a list component. I know I can create a computed property, but not sure how to use sort when it's not really comparing a and b, but just looking to re-order any that are primary. Here's a rough start:
sortedContacts () {
return this.contacts.sort((a, b) => { // what to do here? })
}
Any assistance would be hugely appreciated!