> 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.

# both

Returns a predicate that checks if a value satisfies both predicates.

Binary AND combinator — shorthand for `allPass([f, g])`. When both inputs
are type guards, the result narrows to the intersection of their target types.

```typescript
const isPositiveEven = both((n: number) => n > 0, (n: number) => n % 2 === 0)
isPositiveEven(4)
```

## Usage

### `both<T>(f: (value: T) => boolean, g: (value: T) => boolean)`

Returns a predicate that checks if a value satisfies both predicates.

Binary AND combinator — shorthand for `allPass([f, g])`. When both inputs
are type guards, the result narrows to the intersection of their target types.

```typescript
import { both } from 'massaman'
// or:  import { both } from 'massaman/predicate'

const isPositiveEven = both((n: number) => n > 0, (n: number) => n % 2 === 0)
isPositiveEven(4)
```

#### Parameters


f(value: T) => booleanrequired

the first predicate.


g(value: T) => booleanrequired

the second predicate.

#### Returns

a predicate that returns `true` only when both predicates pass.

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