Skip to content

Don't require pre function to take 3 arguments #1962

@rightaway

Description

@rightaway

In joi.extend, you must define pre as pre(value, state, options). But often it is used just with the value argument. I leave out the remaining unused arguments. But joi throws an error saying 3 arguments are required.

It shouldn't do this because javascript doesn't require a function to have a set number of arguments. And it's common practice to omit trailing arguments that aren't used in the function body.

The final result would be really concise especially with arrow function syntax pre: value => transform(value).

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions