sindresorhus / ow

Function argument validation for humans
https://sindresorhus.com/ow/
MIT License
3.81k stars 108 forks source link

Add support for optional predicates #124

Closed SamVerschueren closed 5 years ago

SamVerschueren commented 5 years ago

This PR introduces the optional predicate and closes the attempt in #82.

I refactored some things which allows us to add more modifiers in the future. Feedback is more than welcome!

Fixes #58

sindresorhus commented 5 years ago

The code looks good. Can you document .optional in the readme here https://github.com/sindresorhus/ow#predicates ?

SamVerschueren commented 5 years ago

Is that the correct place to document this? It's not present on every type. So it's more something that is similar to https://github.com/sindresorhus/ow#owtype.

SamVerschueren commented 5 years ago

Added the docs. Feel free to rephrase or if you still want to document it under the Predicates section, let me know.

sindresorhus commented 5 years ago

No, you're right. That's better and more correct.

sindresorhus commented 5 years ago

I'm super excited about being able to use this!!

sindresorhus commented 5 years ago

Really nice work getting this to work, @SamVerschueren 🎉