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

Method endsWith

source/predicates/array.ts:71–76  ·  view source on GitHub ↗

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

(searchElement: T)

Source from the content-addressed store, hash-verified

69 @param searchElement - The value that should be the end of the array.
70 */
71 endsWith(searchElement: T): this {
72 return this.addValidator({
73 message: (value, label) => `Expected ${label} to end with \`${searchElement}\`, got \`${value.at(-1)}\``,
74 validator: value => value.at(-1) === searchElement,
75 });
76 }
77
78 /**
79 Test an array to include all the provided elements. The values are 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