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);
[].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