MCPcopy
hub / github.com/mathuo/dockview / firstIndex

Function firstIndex

packages/dockview-core/src/array.ts:50–63  ·  view source on GitHub ↗
(
    array: T[] | ReadonlyArray<T>,
    fn: (item: T) => boolean
)

Source from the content-addressed store, hash-verified

48}
49
50export function firstIndex<T>(
51 array: T[] | ReadonlyArray<T>,
52 fn: (item: T) => boolean
53): number {
54 for (let i = 0; i < array.length; i++) {
55 const element = array[i];
56
57 if (fn(element)) {
58 return i;
59 }
60 }
61
62 return -1;
63}
64
65export function remove<T>(array: T[], value: T): boolean {
66 const index = array.findIndex((t) => t === value);

Callers 2

onPointerStartMethod · 0.90
array.spec.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…