> 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/number/required.md).

# required

required()

## Effect

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

## Arguments

None

## Example

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

const schema2 = racoon.number().required();
schema2.validate(undefined); // fail
schema2.validate(null); // fail
```
