It would be nice to have a syntax for supporting descending sort. Writing a manual comparator function is ok, but there could be some sugar that can could provide. Any thoughts on the below code?
var list = new can.List([{
priority: 4,
name: 'low'
}, {
priority: 1,
name: 'high'
}, {
priority: 2,
name: 'middle'
}, {
priority: 3,
name: 'mid'
}]);
// Option 1: Adding a predicate before the property.
list.attr('comparator', '-priority');
// Option 2: Using an options object.
list.attr('comparator', { property: 'priority', direction: 'desc'})
From: https://github.com/canjs/canjs/issues/1643
It would be nice to have a syntax for supporting descending sort. Writing a manual comparator function is ok, but there could be some sugar that can could provide. Any thoughts on the below code?
\cc: @robr24, @alexisabril