> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# tap

Returns a function that runs a side-effect and returns the value unchanged.

Useful for debugging inside `flow` pipelines without breaking the chain.

```typescript
const process = flow(
  fetchUsers,
  tap(users => console.log('count:', users.length)),
  filterActive,
)
```

## Usage

### `tap<T>(fn: (value: T) => unknown)`

Returns a function that runs a side-effect and returns the value unchanged.

Useful for debugging inside `flow` pipelines without breaking the chain.

```typescript
import { tap } from 'massaman'
// or:  import { tap } from 'massaman/function'

const process = flow(
  fetchUsers,
  tap(users => console.log('count:', users.length)),
  filterActive,
)
```

#### Parameters


fn(value: T) => unknownrequired

the side-effecting function to run with each value.

#### Returns

a function that runs `fn` and returns its input unchanged.

```typescript
(value: T) => T
```
