in src/model/immutable/findRangesImmutable.js [23:46]
function findRangesImmutable<T>(
haystack: List<T>,
areEqualFn: (a: T, b: T) => boolean,
filterFn: (value: T) => boolean,
foundFn: (start: number, end: number) => void,
): void {
if (!haystack.size) {
return;
}
let cursor: number = 0;
haystack.reduce((value: T, nextValue, nextIndex) => {
if (!areEqualFn(value, nextValue)) {
if (filterFn(value)) {
foundFn(cursor, nextIndex);
}
cursor = nextIndex;
}
return nextValue;
});
filterFn(haystack.last()) && foundFn(cursor, haystack.count());
}