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

Method startsWith

source/predicates/array.ts:59–64  ·  view source on GitHub ↗

Test an array to start with a specific value. The value is tested by identity, not structure. @param searchElement - The value that should be the start of the array.

(searchElement: T)

Source from the content-addressed store, hash-verified

57 @param searchElement - The value that should be the start of the array.
58 */
59 startsWith(searchElement: T): this {
60 return this.addValidator({
61 message: (value, label) => `Expected ${label} to start with \`${searchElement}\`, got \`${value[0]}\``,
62 validator: value => value[0] === searchElement,
63 });
64 }
65
66 /**
67 Test an array to end with a specific value. The value is tested by identity, not structure.

Callers 2

array.tsFile · 0.45
string.tsFile · 0.45

Calls 1

addValidatorMethod · 0.80

Tested by

no test coverage detected