twitter/typeahead.js — pull request #328 by bolchowka (2013-07-09 12:26:14+00:00)
Title: Parsing suggestions before displaying them

This change adds `suggestionsCallback` option which lets you parse suggestions before displaying them in the browser. For example, you can sort suggestions based on datum properties.

Example usage: sort suggestions by `count` property:
```js
$('input').typeahead({
local: [
{ value: 'Sales', count: 57 },
{ value: 'Server problem', count: 5 },
{ value: 'Support', count: 251 }
],
suggestionsCallback: function (suggestions) {
// sort suggestions by "count" property
return suggestions.sort(function(a, b) {
return b.datum.count - a.datum.count;
})
}
});
```

This example returns suggestions in the following order:
```
Support
Sales
Server problem
```