I stumbled upon this GitHub project a few days ago. It’s called Superstruct, and it looks like an awesome way to validate data in JavaScript.

Let me explain. You probably want to make sure that you get the kind of data you expect as input in JavaScript, either from your back-end API or validating the data that comes as body in your API. But doing so by hand can be very cumbersome. And I thought adding something like Typescript is a little bit heavy-handed.

Superstruct is a simple but compassable way to validate some object, you can add simple values or more complex validation code. And it throws and error if there is any issues with the data.

Leave a Reply