# 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
```


---

# 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://racoon-js.gitbook.io/en/api/number/required.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.
