Skip to content

findIndex

ts
function Dll.findIndex(
    dll: Dll<T>,
    predicate: (value: T, link: DllLink<T>, dll: Dll<T>) => boolean
): number

Returns the index of the first element matching the predicate.

Example

ts
import { Dll } from "@monstermann/dll";

const dll = Dll.create<number>([1, 2, 3, 4, 5]);
const index = Dll.findIndex(dll, (value) => value > 3);
console.log(index); // 3