@AppKu/StashKu

@AppKu/StashKu

v1.0.46

Class

Sort

new Sort()

Source

Members

Methods

static

asc(property) → {Sort}

Creates a new Sort instance that indicates an ascending sort order for the given property.

Parameters

  • property String

    The property to be sorted.

Returns

Source

static

desc(property) → {Sort}

Creates a new Sort instance that indicates an descending sort order for the given property.

Parameters

  • property String

    The property to be sorted.

Returns

Source

static

parse(input) → {Sort|Array.<module:sort~Sort>}

Returns a new Sort instance (or array of Sort instances from a string representation. If no sorts are defined, a null is returned.

Parameters

  • input String

    The string to deconstruct.

Returns

  • Sort Array.<module:sort~Sort>

    A single Sort instance when only one Sort is specifiedy, otherwise an array of Sort instances is returned (in order).

Examples

let myOrderBy = Sort.parse('FirstName desc'); //returns a single Sort
let mySorts = Sort.parse('FirstName, LastName desc'); //returns array of Sort

Source

toString() → {String}

Returns a string representation of the sort property and direction. If the property is missing, then a blank string is returned.

Returns

  • String

Source