SortingModifier

SortingModifier ⇐ ComparisonModifier

A SortingModifier sorts roll results by their value, either ascending or descending.

Kind: global class
Extends: ComparisonModifier

new SortingModifier([direction])

Create a SortingModifier instance.

Throws:

  • RangeError Direction must be 'a' or 'd'
ParamTypeDefaultDescription
[direction]string"a"The direction to sort in; 'a' (Ascending) or 'd' (Descending)

sortingModifier.order : number

The default modifier execution order.

Kind: instance property of SortingModifier

sortingModifier.direction ⇒ string

The sort direction.

Kind: instance property of SortingModifier
Returns: string - Either 'a' or 'd'

sortingModifier.direction

Set the sort direction.

Kind: instance property of SortingModifier
Throws:

  • RangeError Direction must be 'a' or 'd'
ParamTypeDescription
valuestringEither 'a' (Ascending) or 'd' (Descending)

sortingModifier.name ⇒ string

The name of the modifier.

Kind: instance property of SortingModifier
Returns: string - 'sorting'

sortingModifier.notation ⇒ string

The modifier's notation.

Kind: instance property of SortingModifier

sortingModifier.run(results, _context) ⇒ RollResults

Run the modifier on the results.

Kind: instance method of SortingModifier
Returns: RollResults - The modified results

ParamTypeDescription
resultsRollResultsThe results to run the modifier against
_contextStandardDice | RollGroupThe object that the modifier is attached to

sortingModifier.toJSON() ⇒ Object

Return an object for JSON serialising.

This is called automatically when JSON encoding the object.

Kind: instance method of SortingModifier