---
title: "identityWhenever"
description: "Skip the filter when your own test of the props' values says so."
group: "define"
groupTitle: "Defining a shader"
categoryId: "slots"
categorySlug: "slots"
categoryTitle: "Identity & recompile rules"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/slots.ts#L110"
---

# identityWhenever

Skip the filter when your own test of the props' values says so.

```ts
identityWhenever(
  props: string[],
  when: (values: Record<string, unknown>) =,
> boolean): IdentityRule
```

Import `identityWhenever` from `shaders/std`.

List in `props` every prop the test reads: a per-pixel mapped prop among them disables the skip, and the engine needs the list to know which.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `props` | `string[]` |  |
| `when` | `(values: Record<string, unknown>) => boolean` |  |

## Example

```ts
identityWhen: identityWhenever(['amount', 'mode'], (v) => v.amount === 0 || v.mode === 'off')
```

## See also

- [`isZero`](/docs/primitives/slots/iszero) — Skip the filter entirely while `prop` is exactly 0.
- [`isValue`](/docs/primitives/slots/isvalue) — Skip the filter entirely while `prop` equals `value`, for a filter whose no-op is not 0.
- [`allOf`](/docs/primitives/slots/allof) — Skip the filter only while every rule holds, for a no-op that needs several props at rest.