public/lib/emberjs/ember.js
function sort(itemsKey, sortDefinition) {
      Ember.assert('Ember.computed.sort requires two arguments: an array key to sort and ' +
        'either a sort properties key or sort function', arguments.length === 2);

      if (typeof sortDefinition === 'function') {
        return customSort(itemsKey, sortDefinition);
      } else {
        return propertySort(itemsKey, sortDefinition);
      }
    }
function sort(itemsKey, sortDefinition) {
      Ember.assert('Ember.computed.sort requires two arguments: an array key to sort and ' +
        'either a sort properties key or sort function', arguments.length === 2);

      if (typeof sortDefinition === 'function') {
        return customSort(itemsKey, sortDefinition);
      } else {
        return propertySort(itemsKey, sortDefinition);
      }
    }
function sort ( itemsKey , sortDefinition ) { Ember . assert ( 'Ember.computed.sort requires two arguments: an array key to sort and ' + 'either a sort properties key or sort function' , arguments . length === 2 ) ; if ( typeof sortDefinition === 'function' ) { return customSort ( itemsKey , sortDefinition ) ; } else { return propertySort ( itemsKey , sortDefinition ) ; } }
A computed property which returns a new array with all the
properties from the first dependent array sorted based on a property
or sort function.

The callback method you provide should have the following signature:

```javascript
function(itemA, itemB);
```

- `itemA` the first item to compare.
- `itemB` the second item to compare.

This function should return negative number (e.g. `-1`) when `itemA` should come before
`itemB`. It should return positive number (e.g. `1`) when `itemA` should come after
`itemB`. If the `itemA` and `itemB` are equal this function should return `0`.

Therefore, if this function is comparing some numeric values, simple `itemA - itemB` or
`itemA.get( 'foo' ) - itemB.get( 'foo' )` can be used instead of series of `if`.

Example

```javascript
var ToDoList = Ember.Object.extend({
using standard ascending sort
todosSorting: ['name'],
sortedTodos: Ember.computed.sort('todos', 'todosSorting'),

using descending sort
todosSortingDesc: ['name:desc'],
sortedTodosDesc: Ember.computed.sort('todos', 'todosSortingDesc'),

using a custom sort function
priorityTodos: Ember.computed.sort('todos', function(a, b){
if (a.priority > b.priority) {
return 1;
} else if (a.priority < b.priority) {
return -1;
}

return 0;
})
});

var todoList = ToDoList.create({todos: [
{ name: 'Unit Test', priority: 2 },
{ name: 'Documentation', priority: 3 },
{ name: 'Release', priority: 1 }
]});

todoList.get('sortedTodos');      // [{ name:'Documentation', priority:3 }, { name:'Release', priority:1 }, { name:'Unit Test', priority:2 }]
todoList.get('sortedTodosDesc');  // [{ name:'Unit Test', priority:2 }, { name:'Release', priority:1 }, { name:'Documentation', priority:3 }]
todoList.get('priorityTodos');    // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
```

@method computed.sort
@for Ember
@param {String} dependentKey
@param {String or Function} sortDefinition a dependent key to an
array of sort properties (add `:desc` to the arrays sort properties to sort descending) or a function to use when sorting
@return {Ember.ComputedProperty} computes a new sorted array based
on the sort property array or callback function
A computed property which returns a new array with all the properties from the first dependent array sorted based on a property or sort function .