Skip to content
Ryan edited this page Jul 23, 2016 · 2 revisions

Sorter

Kind: global class

new Sorter([locale])

Constructs a sorter instance.

Param Type Description
[locale] string the locale to sort by (e.g. 'en-US')

sorter.sortAsc(arr) ⇒ Array

Sorts values in ascending order.

Kind: instance method of Sorter
Returns: Array - a new sorted Array

Param Type Description
arr Array Array of value to sort

sorter.sortDes(arr) ⇒ Array

Sorts values in descending order.

Kind: instance method of Sorter
Returns: Array - a new sorted Array

Param Type Description
arr Array Array of value to sort

sorter.sortAscFunc() ⇒ function

Constructs a function to sort values in ascending order.

Kind: instance method of Sorter

sorter.sortDesFunc() ⇒ function

Constructs a function to sort values in descending order.

Kind: instance method of Sorter

sorter.sortByPropAsc(arr, prop) ⇒ Array

Sorts an Array of objects into ascending order by a certain property.

Kind: instance method of Sorter
Returns: Array - a new sorted Array

Param Type Description
arr Array Array of objects to sort
prop string property to sort by

sorter.sortByPropDes(arr, prop) ⇒ Array

Sorts an Array of objects into descending order by a certain property.

Kind: instance method of Sorter
Returns: Array - a new sorted Array

Param Type Description
arr Array Array of objects to sort
prop string property to sort by

sorter.sortByPropAscFunc(prop) ⇒ function

Constructs a function to sort values in ascending order by a certain property.

Kind: instance method of Sorter

Param Type Description
prop string property to sort by

sorter.sortByPropDesFunc(prop) ⇒ function

Constructs a function to sort values in descending order by a certain property.

Kind: instance method of Sorter

Param Type Description
prop string property to sort by

sorter.localeSortAsc(arr) ⇒ Array

Sorts values by locale in ascending order.

Kind: instance method of Sorter
Returns: Array - a new sorted Array

Param Type Description
arr Array Array of value to sort

sorter.localeSortDes(arr) ⇒ Array

Sorts values by locale in descending order.

Kind: instance method of Sorter
Returns: Array - a new sorted Array

Param Type Description
arr Array Array of value to sort

sorter.localeSortAscFunc() ⇒ function

Constructs a function to sort values by locale in ascending order.

Kind: instance method of Sorter

sorter.localeSortDesFunc() ⇒ function

Constructs a function to sort values by locale in descending order.

Kind: instance method of Sorter

sorter.localeSortByPropAsc(arr, prop) ⇒ Array

Sorts an Array of objects by locale into ascending order by a certain property.

Kind: instance method of Sorter
Returns: Array - a new sorted Array

Param Type Description
arr Array Array of objects to sort
prop string property to sort by

sorter.localeSortByPropDes(arr, prop) ⇒ Array

Sorts an Array of objects by locale into descending order by a certain property.

Kind: instance method of Sorter
Returns: Array - a new sorted Array

Param Type Description
arr Array Array of objects to sort
prop string property to sort by

sorter.localeSortByPropAscFunc(prop) ⇒ function

Constructs a function to sort values by locale in ascending order by a certain property.

Kind: instance method of Sorter

Param Type Description
prop string property to sort by

sorter.localeSortByPropDesFunc(prop) ⇒ function

Constructs a function to sort values by locale in descending order by a certain property.

Kind: instance method of Sorter

Param Type Description
prop string property to sort by