# not

```erlang
not :: Any input => Boolean negation
```

## description

Returns the logical negation of the input value. It's the functional equivalent of the JavaScript not operator `!`. It can be very useful in a function composition chain, to avoid writing code like this:

```javascript
compose(b => !b, some(...))
```

As you can see from the type signature, it obviously accepts `Booleans` as input values, but also values of any types. Just beware of [how JavaScript coerces values to their Boolean equivalents](https://developer.mozilla.org/en-US/docs/Glossary/Truthy).

## examples

### basic example

```javascript
import { not } from 'conductor'

not(true) // false
```

### usage in a function composition

```javascript
import { compose, not } from 'conductor'

const illegal_characters = /[?:;!/-]/
const searchIllegalCharacters = str => illegal_characters.test(str)
const isValid = compose(not, searchIllegalCharacters)
```

Suppose we want have a function which checks if an input string is valid. The input is considered valid if does not contain any illegal characters. The illegal characters are listed in a regular expression. Then, we use [`RegExp.prototype.test`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test) to see if any of these characters is matched in the input string. Since our input is considered valid only if it `searchIllegalCharacters` returns false, we use the logical not operator to negate its result.


---

# Agent Instructions: 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:

```
GET https://conductor.js.org/api-reference/not.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
