> 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/other-common-api/format.md).

# format

format(callback, \[ctx])

## Effect

Format the final return value of `validate` and `validateSilent`, the return value of `callback` will be the final return value.

## Arguments

* `callback` ***(function)*** - The format function. *The function has an argument: the return value returned by `validate`*. The return value of `callback` is recommended but not necessarily to be the type of the schema declared.
* `[ctx]` ***(\*)*** - The execution context of callback.

## Example

```javascript
const schema = racoon.number();
schema.validate(1.2).format(num => num.toFixed(2)); // pass, 返回 '1.20'
```
