new Result( documents )

Description

Creates a Result instance.

Parameters
Name Type Description
documents Array.<object>

Documents for sorting.

Details

Members


documents

Description

Get the filtered and possibly altered documents.

Returns

Filtered and possibly altered documents.

Details

originalDocuments

Description

Get the filtered but unaltered results documents.

Returns

Filtered but unaltered documents.

Details

Methods


simpleSort( prop [, desc ] ) → {this}

Description

Sort the results given a specific property. Supported property value types are string, number, boolean or Date.

Parameters
Name Type Attributes Default Description
prop string

Property name within the documents.

desc boolean <optional>
false

Whether to sort the results descending.

Returns

Result instance.

Details

sort( sortFn ) → {this}

Description

Sort the results using your own custom sort function.

Parameters
Name Type Description
sortFn function

Custom sort function which will be applied on each result.

Returns

Result instance.

Details

map( mapFn ) → {this}

Description

Map the results using your own custom map function.

Parameters
Name Type Description
mapFn function

Custom map function which will be applied on each result.

Returns

Result instance.

Details

limit( value ) → {this}

Description

Limit the number of results.

Parameters
Name Type Description
value number

Limit value for the results.

Returns

Result instance.

Details