One Page

Functional to Imperative Cheat Sheet

June 20, 2019

Here’s how you convert Imperative -> Functional!

  • if statements = filter
  • two params, where one gives info to add things to the other = reduce
  • one object transformed into another = map

Note: If you only care about one of the branches of the if condition, then use filter. Because you’re not going to get access to the false case.

  • if statements, when you care about both branches = flatMap

Aniket Kadam, author

Written by Aniket Kadam - building useful things. Follow me on Twitter