Open Martin-Pitt opened 6 years ago
I know @SamVerschueren is working on explicitly optional predicates, but I think your use case is handled by ow
normally without adding anything to its API surface.
function getPage(identifier) {
ow(identifier, ow.string)
}
Afaik it's not currently possible to use ow
to ensure a variable is defined without checking its type, so maybe that's something we could add:
function getPage(identifier) {
// note: this doesn't currently work, but is a proposed workaround
ow(identifier, ow.any)
}
Could there be a ow.mandatory that throws by using it as default arg?
Reference: 16. Mandatory Parameter Shorthand