Skip to content

Instantly share code, notes, and snippets.

@windwarrior
Created January 30, 2018 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save windwarrior/fd5cf8f0572bcacd2c65aaaae9169265 to your computer and use it in GitHub Desktop.
Save windwarrior/fd5cf8f0572bcacd2c65aaaae9169265 to your computer and use it in GitHub Desktop.
// Style 1
content_list = considered_devs
.filter(x => x.content)
.map(x => {
// this is a more complex lambda
})
.map(moreComplexFunction)
.map(x => x.content)
.reduce((accum, x) => accum.concat(x), [])
// Style 2
let content_list = considered_devs.filter(x => x.content)
.map(x => {
// this is a more complex lambda
})
.map(moreComplexFunction)
.map(x => x.content)
.reduce((accum, x) => accum.concat(x), [])
// Style 3
let content_list = considered_devs.filter(
x => x.content
).map(x => {
// this is a more complex lambda
}).map(
moreComplexFunction
).map(
x => x.content
).reduce(
(accum, x) => accum.concat(x),
[]
)
// Style 4
let content_list =
considered_devs.filter(x => x.content)
.map(x => {
// this is a more complex lambda
})
.map(moreComplexFunction)
.map(x => x.content)
.reduce((accum, x) => accum.concat(x), [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment