[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Types](https://evolu.dev/docs/api-reference/common/Types) › PredicateWithIndex

```ts
type PredicateWithIndex<T> = (value: T, index: number) => boolean;
```

Defined in: [packages/common/src/Types.ts:71](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/common/src/Types.ts#L71)

Checks a condition on a value at a given index and returns a boolean.

Useful for callbacks that need both the element and its position.

### Example

```ts
const isEvenIndex: PredicateWithIndex<string> = (value, index) =>
  index % 2 === 0;

const items = ["a", "b", "c", "d"];
const evenIndexItems = items.filter(isEvenIndex); // ["a", "c"]
```