✔||? Commit or Vomit | checks.some()

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.isN…


This content originally appeared on DEV Community and was authored by ?? Jasper de Jager

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 (something I could commit)
?: Vomit (I'd never commit this)
?: I like your post please continue this series!

Let's vote! ?

Photo by Nik Shuliahin on Unsplash


This content originally appeared on DEV Community and was authored by ?? Jasper de Jager


Print Share Comment Cite Upload Translate Updates
APA

?? Jasper de Jager | Sciencx (2021-04-20T09:13:41+00:00) ✔||? Commit or Vomit | checks.some(). Retrieved from https://www.scien.cx/2021/04/20/%e2%9c%94%f0%9f%a4%a2-commit-or-vomit-checks-some/

MLA
" » ✔||? Commit or Vomit | checks.some()." ?? Jasper de Jager | Sciencx - Tuesday April 20, 2021, https://www.scien.cx/2021/04/20/%e2%9c%94%f0%9f%a4%a2-commit-or-vomit-checks-some/
HARVARD
?? Jasper de Jager | Sciencx Tuesday April 20, 2021 » ✔||? Commit or Vomit | checks.some()., viewed ,<https://www.scien.cx/2021/04/20/%e2%9c%94%f0%9f%a4%a2-commit-or-vomit-checks-some/>
VANCOUVER
?? Jasper de Jager | Sciencx - » ✔||? Commit or Vomit | checks.some(). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/20/%e2%9c%94%f0%9f%a4%a2-commit-or-vomit-checks-some/
CHICAGO
" » ✔||? Commit or Vomit | checks.some()." ?? Jasper de Jager | Sciencx - Accessed . https://www.scien.cx/2021/04/20/%e2%9c%94%f0%9f%a4%a2-commit-or-vomit-checks-some/
IEEE
" » ✔||? Commit or Vomit | checks.some()." ?? Jasper de Jager | Sciencx [Online]. Available: https://www.scien.cx/2021/04/20/%e2%9c%94%f0%9f%a4%a2-commit-or-vomit-checks-some/. [Accessed: ]
rf:citation
» ✔||? Commit or Vomit | checks.some() | ?? Jasper de Jager | Sciencx | https://www.scien.cx/2021/04/20/%e2%9c%94%f0%9f%a4%a2-commit-or-vomit-checks-some/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.