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

# toInteger

Converts a value to an integer by calling `toNumber` and truncating.

```typescript
toInteger('4.9') // 4
toInteger(null) // 0
```

## Usage

### `toInteger(value: unknown)`

Converts a value to an integer by calling `toNumber` and truncating.

```typescript
import { toInteger } from 'massaman'
// or:  import { toInteger } from 'massaman/conversion'

toInteger('4.9') // 4
toInteger(null) // 0
```

#### Parameters


valueunknownrequired

the value to convert.

#### Returns

the converted number truncated toward zero.

```typescript
number
```
