---
description: 'compose :: [ Function ] → a → Boolean'
---

# compose

It's the very backbone of **Deep Waters**, it takes a list of validators $$[validators]$$ (_functions that accept a value and return a boolean_)  and returns a new function that takes a value $$v$$ and evaluates whether $$v$$ is valid for all the validators in $$[validators]$$.

{% code title="isEmail.js" %}
```javascript
import compose from './compose';
import isString from './isString';
import matchesPattern from './matchesPattern';

const isEmail = compose(
  isString,
  matchesPattern(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/),
);

export default isEmail;
```
{% endcode %}

{% hint style="info" %}
Please note, **compose** removes all the duplicate validators
{% endhint %}

#### Related validators

{% content-ref url="when" %}
[when](when)
{% endcontent-ref %}

{% content-ref url="or" %}
[or](or)
{% endcontent-ref %}

{% content-ref url="not" %}
[not](not)
{% endcontent-ref %}

