# 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](https://antonioru.gitbook.io/deep-waters/composition/when)
{% endcontent-ref %}

{% content-ref url="or" %}
[or](https://antonioru.gitbook.io/deep-waters/composition/or)
{% endcontent-ref %}

{% content-ref url="not" %}
[not](https://antonioru.gitbook.io/deep-waters/composition/not)
{% endcontent-ref %}
