MCPcopy
hub / github.com/sindresorhus/ow / minLength

Method minLength

source/predicates/array.ts:33–39  ·  view source on GitHub ↗

Test an array to have a minimum length. @param length - The minimum length of the array.

(length: number)

Source from the content-addressed store, hash-verified

31 @param length - The minimum length of the array.
32 */
33 minLength(length: number): this {
34 return this.addValidator({
35 message: (value, label) => `Expected ${label} to have a minimum length of \`${length}\`, got \`${value.length}\``,
36 validator: value => value.length >= length,
37 negatedMessage: (value, label) => `Expected ${label} to have a maximum length of \`${length - 1}\`, got \`${value.length}\``,
38 });
39 }
40
41 /**
42 Test an array to have a maximum length.

Callers 15

fnFunction · 0.45
nullable.tsFile · 0.45
test.tsFile · 0.45
string-email.tsFile · 0.45
custom-message.tsFile · 0.45
map.tsFile · 0.45
is-predicate.tsFile · 0.45
array.tsFile · 0.45
set.tsFile · 0.45
object.tsFile · 0.45
string.tsFile · 0.45
typed-array.tsFile · 0.45

Calls 1

addValidatorMethod · 0.80

Tested by

no test coverage detected