# all

```typescript
function all(predicate1, predicate2, ...): Predicate
```

This function takes as a parameters arbitrary number of `Predicate`s, and returns a `Predicate` that matches only if all of the `Predicates` provided as arguments match.

If any of the `Predicates` provided as arguments doesn't match the value, the error(s) returned by that first (from left hand side) failing `Predicate` are returned from the combined `Predicate`.

## Examples:

### Failing example:

First, let's define an example `value` that we want to verify and wrap it with `asVerificable():`

```typescript
const { asVerificable, all, isNumber, isString, isArray, getErrors } = require("verifica");

const value = 123;
const verificable = asVerificable(value);
```

Next, let's use the `all()` function to combine multiple predicates into one:

```typescript
const combinedPredicate = all(
    isNumber,
    isString,
    isArray,
);
```

Only the error(s) from the first failing `Predicate` (`isString`) are returned from the `combinedPredicate`. Errors from the next failing predicates (`isArray`) are not returned:

```typescript
getErrors(verificable, combinedPredicate);
// [{ type: "isString", path: [] }]
```

### Matching example:

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

const value = 123;
const verificable = asVerificable(value);
```

We can also create more useful combined predicate like:

```typescript
const combinedPredicate2 = all(
    isInteger,
    isNumberInRange({ min: 100, max: 200})
);
```

And test the value against this combined `Predicate`:

```typescript
isValid(verificable, combinedPredicate2); // true
```
