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

Method length

source/predicates/array.ts:21–26  ·  view source on GitHub ↗

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

(length: number)

Source from the content-addressed store, hash-verified

19 @param length - The length of the array.
20 */
21 length(length: number): this {
22 return this.addValidator({
23 message: (value, label) => `Expected ${label} to have length \`${length}\`, got \`${value.length}\``,
24 validator: value => value.length === length,
25 });
26 }
27
28 /**
29 Test an array to have a minimum length.

Callers 3

array.tsFile · 0.45
string.tsFile · 0.45
typed-array.tsFile · 0.45

Calls 1

addValidatorMethod · 0.80

Tested by

no test coverage detected