ariatemplates/hashspace — pull request #220 by b-laporte (2014-06-29 18:37:40+00:00)
Title: orderBy and Sorter to manage list sorting

This PR introduces two new utilities to manage list ordering: orderBy and Sorter. As you will see orderBy is very convenient for simple cases, whereas Sorter (that internally uses orderBy) provides more advanced features:

```
{template list(persons)}

List sorted with the orderBy() function:

{foreach p in persons|orderBy:"name"}

{p.name}

{/foreach}

{let nameSorter=new Sorter({property:"name",states:"ADN"})}

List sorted with a Sorter object (current state: {nameSorter.state})

{foreach p in persons|nameSorter}

{p.name}

{/foreach}

Change sort order

{/template}

var people = [
{name:"Homer", age:38},
{name:"Marge", age:38},
{name:"Bart", age:10},
{name:"Lisa", age:8},
{name:"Maggie", age:1}
];

// display the template in the #output div
list(people).render("output");
```
Both features are published on hsp.global, so they don't need to be required and are available everywhere.