MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / arrayContainsArray

Function arrayContainsArray

src/shared/utils/array.ts:24–32  ·  view source on GitHub ↗
(haystack: T[], needle: T[])

Source from the content-addressed store, hash-verified

22}
23
24export function arrayContainsArray<T>(haystack: T[], needle: T[]): boolean {
25 // Loop over valid starting points for the subarray
26 for (let i = 0; i <= haystack.length - needle.length; i++) {
27 // Check if the relevant length sublist equals the other array.
28 if (arraysEqual(haystack.slice(i, i + needle.length), needle))
29 return true;
30 }
31 return false;
32}

Callers 2

ensureArrayContainsArrayFunction · 0.90
util.test.tsFile · 0.90

Calls 1

arraysEqualFunction · 0.85

Tested by

no test coverage detected