An Interest In:
Web News this Week
- April 13, 2024
- April 12, 2024
- April 11, 2024
- April 10, 2024
- April 9, 2024
- April 8, 2024
- April 7, 2024
April 20, 2021 09:13 am GMT
Original Link: https://dev.to/jmdejager/commit-or-vomit-checks-some-46mh
|| 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.isNewUser) { checks.push(data.email !== undefined)} else { checks.push(data.deleted === false)}const isValid = 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
Original Link: https://dev.to/jmdejager/commit-or-vomit-checks-some-46mh
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To