Array Verifier Reference
Created by should().array<T>(entry: (T | null | undefined)[] | null | undefined).
Methods
Method | Passes when |
|---|---|
| the array has no items |
| exact item count |
| neighbors satisfy the ordering — see below |
| at least one element matches |
| exactly |
| at least one element satisfies the condition |
| exactly |
| every element satisfies the condition |
| no duplicates by |
| same elements, same order |
| same elements, any order |
Plus the inherited not and defined().
The identifier parameter
(e?: T | null) => any — extracts the comparison key from an element. Defaults to the element itself, which makes object comparisons reference-based; always provide it for object collections (Arrays).
ArrayOrderedSettings<T>
Field | Type | Default |
|---|---|---|
|
|
|
|
|
|
Neighbors compare with <= (asc) / >= (desc); equal neighbors are allowed in both directions. Deep dive: Array Ordering.
Representative messages
The collection is not empty./The collection is empty.Elements aren't ordered./Elements are ordered.The collection doesn't contain the expected element.The collections are not equal.