Skip to content

Instantly share code, notes, and snippets.

@lubien
Created June 24, 2017 06:05
Show Gist options
  • Save lubien/4dfcfab6756826589fbf06bfcd048023 to your computer and use it in GitHub Desktop.
Save lubien/4dfcfab6756826589fbf06bfcd048023 to your computer and use it in GitHub Desktop.
Meeting Lambda #13: Quantification - Validate Posts
const validPost = post =>
post.title && post.title.length > 10 && post.content
const posts =
[ {title: 'short'}
, {title: 'fairly long', content: 'Foobar'}
, {title: 'yet another', content: 'fixture'}
]
const validPosts = posts.every(validPost)
console.log(validPosts) // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment