[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:104](https://github.com/evoluhq/evolu/blob/b6ade4b22d4be1758761a2712668e870d3e602c7/packages/common/src/Types.ts#L104)

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.

### Filtering by position

```ts

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

assertEqual(["a", "b", "c", "d"].filter(isEvenIndex), ["a", "c"]);
```