> For the complete documentation index, see [llms.txt](https://racoon-js.gitbook.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://racoon-js.gitbook.io/en/api/boolean/required.md).

# required

required()

## Effect

Restrict the detected value is not `undefined | null`.

## Arguments

None

## Example

```javascript
const schema1 = racoon.boolean();
schema1.validate(undefined); // pass, return: undefined
schema1.validate(null); // pass, return: null

const schema2 = racoon.boolean().required();
schema2.validate(undefined); // fail
schema2.validate(null); // fail
schema2.validate(false); // pass
```
