DEV Community

0 seconds of 0 secondsVolume 90%
Press shift question mark to access a list of keyboard shortcuts
00:00
00:00
00:00
 
itihon
itihon

Posted on

Quick introduction to isomorphic-validation javascript library.

Isomorphic-validation is a Javascript library that allows writing the same validation logic once for client and server side, reuse it across different forms in your app, and offers a straightforward way of creating UI effects for indicating fields validity state.

In this video I wanted to show how easily client side form validation can be made with this library.

See the playground with the code from the video.

The concept is simple.

When running on the client side, a Validation object was designed to be used as an event handler. Validation objects can be grouped into another object so that a single Validation is in the "valid" state when all predicates return true (or a Promise with true in case they are asynchronous) and a grouping Validation is in the "valid" state when its all grouped Validation objects are in the "valid" state as well.

Validation and Predicate objects can be in one of the following states: started -> valid|invalid -> [changed] -> validated. You can think of it as a finite-state machine. A validation result at each state (except for valid and invalid) can be either true or false.

We simply need to declare effect values with desired delays for validation result states and associate UI effects with desired Validation and Predicate states. This approach makes for seemingly linear code, all asynchronicity and conditionals are abstracted away.

Quadratic AI

Quadratic AI – The Spreadsheet with AI, Code, and Connections

  • AI-Powered Insights: Ask questions in plain English and get instant visualizations
  • Multi-Language Support: Seamlessly switch between Python, SQL, and JavaScript in one workspace
  • Zero Setup Required: Connect to databases or drag-and-drop files straight from your browser
  • Live Collaboration: Work together in real-time, no matter where your team is located
  • Beyond Formulas: Tackle complex analysis that traditional spreadsheets can't handle

Get started for free.

Watch The Demo 📊✨

Top comments (0)

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup 🚀

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay