> 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/isarrayof.md).

# isArrayOf

```typescript
isArrayOf(itemPredicate)
```

Verifies if provided `Validatable` represents an array where each item matches provided `itemPredicate`.

### Arguments:

* `itemPredicate` - required, of type `Predicate`

### Possible errors:

#### If provided `Validatable` is not an array:

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

#### If provided `Validatable` is an array that contains some items not matching the `itemPredicate`:

Errors for all not matching items will be returned, as errors returned by `itemPredicate`. `path` property of each error will point to the element in the array that didn't match.

### Examples:

Each of examples uses this import statement:

```typescript
const { asVerificable, isValid, isArrayOf, isString, getErrors } = require("verifica");
```

#### Non-array values (like string in this example) are not a valid array, and will fail with an `isArray` error:

```typescript
const verificable = asVerificable("something");
isValid(verificable, isArrayOf(isString)); // false
getErrors(verificable, isArrayOf(isString)); // [{ type: "isArray", path: [] }]
```

#### Empty array satisfies any `itemPredicate`, since there are no array elements that doesn't match it:

```typescript
const verificable = asVerificable([]);
isValid(verificable, isArrayOf(isString)); // true
```

#### If some items in the array doesn't match `itemPredicate`, `isArrayOf` fails returning errors for all not-matching items. Errors are as returned by `itemPredicate`, including item index in the array in the `path` property:

```typescript
const verificable = asVerificable(["one", "two", null]);
isValid(verificable, isArrayOf(isString)); // false
getErrors(verificable, isArrayOf(isString)); // [{ type: "isString", path: [2] }]
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://radoslaw-medryk.gitbook.io/verifica/predicates/built-in-predicates/isarrayof.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
