richardscarrott / ok-computer

λ "Functions all the way down" data validation for JavaScript and TypeScript.
MIT License
79 stars 0 forks source link

Add peer, andPeers, nandPeers, orPeers, xorPeers and oxorPeers #1

Closed richardscarrott closed 3 years ago

richardscarrott commented 3 years ago

Peer functions akin to joi object().and / object().or etc.

e.g

const validator = object({
    A: and(or(nullish, string), orPeers('B')),
    B: and(or(nullish, string), orPeers('A'))
});

TODO: Consider exposing a singular version?