βœ”||🀒 Commit or Vomit | checks.some()

🐀πŸ₯‡ Jasper de Jager - Apr 20 '21 - - Dev Community

It's Tuesday!

Time for a new βœ”||🀒 Commit or Vomit! This time it is about using [].some(check β‡’ !check). What do you think of the following code?

const checks = [
    data.age > 18,
    data.username.length > 6    
];
if(data.isNewUser) {
    checks.push(data.email !== undefined)
} else {
    checks.push(data.deleted === false)
}

const isInvalid = checks.some(check => !check);
Enter fullscreen mode Exit fullscreen mode

[].some(true) βœ”||🀒?

❀: Commit (I'd commit something like this)
🏷: Vomit (we all know unicorns don't vomit)
πŸ¦„: Like your post please continue this series!

Let's vote! 😊

Photo by Nik Shuliahin on Unsplash

. . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player