> For the complete documentation index, see [llms.txt](https://radoslaw-medryk.gitbook.io/verifica/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://radoslaw-medryk.gitbook.io/verifica/predicates/built-in-predicates/isinteger.md).

# isInteger

```typescript
isInteger
```

Verifies if provided `Verificable` represents a number that is an integer. Integer values are values with the part after decimal point being `0`.

The check internally is done by calling the JS function `Number.isInteger()`.

### Possible errors:

#### If provided `Verificable` is not a number:

```typescript
{
    type: "isNumber",
    path: [/* ... */]
}
```

#### If provided `Verificable` is not a integer:

```typescript
{
    type: "isInteger",
    path: [/* ... */]
}
```

### Examples:

Each of examples uses this import statement:

```typescript
const { asVerificable, isValid, isInteger } = require("verifica");
```

#### Null or undefined is not considered a number:

```typescript
const verificable = asVerificable(null);
isValid(verificable, isInteger); // false
```

#### String value is not considered a number as well:

```typescript
const verificable = asVerificable("123");
isValid(verificable, isInteger); // false
```

#### `Infinity`, `-Infinity`, or `NaN` are not considered integers:

```typescript
const verificable = asVerificable(Infinity);
isValid(verificable, isInteger); // false
```

#### Numbers with non-zero decimal part are not considered integers:

```typescript
const verificable = asVerificable(12345.67);
isValid(verificable, isInteger); // false
```

#### Numbers with decimal part equal to zero are considered integers:

```typescript
const verificable = asVerificable(12345);
isValid(verificable, isInteger); // true
```
