kanwren / augustus

Serialization/data validation combinator library for TypeScript
MIT License
1 stars 1 forks source link

Add more union schemas #16

Closed GRarer closed 2 years ago

GRarer commented 2 years ago

Adds two new schemas for unions: literalUnion for creating a union of any number of literal values, and multiUnion for constructing a union from more than two trivial schemas (this previously required nesting the union function).

multiUnion is a bad placeholder name and I welcome suggestions about what that function should be called.

kanwren commented 2 years ago

I'm a fan of unionMany in place of multiUnion. I'm not sure what to call literalUnion in keeping with that convention, though; literalUnionMany?

kanwren commented 2 years ago

Thanks! I'll probably rename all of the union combinators soon and maybe namespace them (union and unionOf were truly terrible names), but this is great for now :)