How to write inexpensive pure functions in javascript?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/functionalprogramming

Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Sonar - Write Clean JavaScript Code. Always.
  • ramda

    :ram: Practical functional Javascript

    That said, what it looks like you're doing may be done with Array.prototype.reduce where you can attempt to do you entire pipeline of operations on each element (unless they're not mutually exclusive) all in a single pass, even excluding elements that don't pass a particular filter. The reducer callback that you employ can employ other reducers, too. This sounds very similar to writing a JSON parser to me -- recursive parsing of nested hashes or other collections. I've done this in a functional language before. If you're not opposed to an abstraction, there is RamdaJS - https://ramdajs.com/. I enjoyed tinkering with it when I was still doing JavaScript, and have seen it pop up from time to time.

  • Immer

    Create the next immutable state by mutating the current one

    It’s harder to write more functional code without the right tools. JavaScript is okay as a functional language (better than most tbh), but is missing some key components like immutable data structures. You might checkout Immer or Immutable.js to fill this gap.

  • Appwrite

    Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts