Accepts the following options (in addition to generic class-validator options):
monotonicity: Monotonicity
The required ordering of the array.projection?: (element) => number
(mutually exclusive with comparator
)
Project an array element to a number which is then used for comparison.comparator?: (a, b) => number
(mutually exclusive with projection
)
Directly compare two elements (as in Array.sort).If neither projection
nor comparator
is given, the values are compared ordinally.
Checks if the given value is an array sorted in either (strictly) ascending or (strictly) descending order.
This validator will always pass if the given value is an empty array.
Example