hapijs / joi

The most powerful data validation library for JS
Other
20.95k stars 1.51k forks source link

Allow 0x prefix for hex strings #3011

Closed BolajiOlajide closed 10 months ago

BolajiOlajide commented 10 months ago

Closes #2386

This PR updates the regex for validating hexadecimal. This allows hexes with the 0x prefix to be validated properly and those without to also pass validation provided they're valid hex strings.

CleanShot 2024-01-10 at 03 03 26@2x

BolajiOlajide commented 10 months ago

Kindly take a look @Marsup

Marsup commented 10 months ago

Thanks for the PR. This feels like we should add an option (defaulting to false) to support this, otherwise I would consider it a breaking change. It would probably be more flexible anyway.

BolajiOlajide commented 10 months ago

Thanks for the PR. This feels like we should add an option (defaulting to false) to support this, otherwise I would consider it a breaking change. It would probably be more flexible anyway.

Updated!

Marsup commented 10 months ago

I'm going to do some changes before releasing it but it's already a good start, thanks a lot!

richardpringle commented 9 months ago

🙌