Sort an array of objects either by property, sort function, or comparator function.