Better data validation with Guard Clauses
Have you ever heard of Defensive Programming and the Fail-Fast system design? These are guidelines which tell us to always validate a method's input. Something like this:
function sayHi(firstName, lastName) {
if (!firstName?.length)
throw new E...
phillcode.io16 min read
Phillippe Santana
CTO at INA
The newer and better version of the guard clauses is now available as an NPM package. Go get it at @phillcode/guard, install with
npm i @phillcode/guardor inspect the source code.