Test an array to have a maximum length. @param length - The maximum length of the array.
(length: number)
| 44 | @param length - The maximum length of the array. |
| 45 | */ |
| 46 | maxLength(length: number): this { |
| 47 | return this.addValidator({ |
| 48 | message: (value, label) => `Expected ${label} to have a maximum length of \`${length}\`, got \`${value.length}\``, |
| 49 | validator: value => value.length <= length, |
| 50 | negatedMessage: (value, label) => `Expected ${label} to have a minimum length of \`${length + 1}\`, got \`${value.length}\``, |
| 51 | }); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | Test an array to start with a specific value. The value is tested by identity, not structure. |
no test coverage detected