lodash VS immutable-js

Compare lodash vs immutable-js and see what are their differences.

lodash

A modern JavaScript utility library delivering modularity, performance, & extras. (by lodash)

immutable-js

Immutable persistent data collections for Javascript which increase efficiency and simplicity. (by immutable-js)
Our great sponsors
  • Sonar - Write Clean JavaScript Code. Always.
  • Scout APM - Truly a developer’s best friend
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Zigi - Close all those tabs. Zigi will handle your updates.
lodash immutable-js
146 31
55,037 32,349
0.5% 0.2%
0.0 4.8
16 days ago 16 days ago
JavaScript TypeScript
GNU General Public License v3.0 or later MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

lodash

Posts with mentions or reviews of lodash. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-11-28.

immutable-js

Posts with mentions or reviews of immutable-js. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-10-28.
  • Immutable Collections should be Your Default
    2 projects | reddit.com/r/programming | 28 Oct 2022
    I can't speak to C# and Java, but the suggestion in this post: ImmutableJS already uses Persistent data structures. (It's the second sentence of their introduction)
  • immutable-js VS riux - a user suggested alternative
    2 projects | 12 Aug 2022
  • Twitter Clone Part 3: Adding Tweet Reactions and Showing Notifications
    3 projects | dev.to | 29 Jun 2022
    feed.feedManager.state.activities is an immutable Map (created with Immutabe.js), so you get the activity object using getIn and toJS methods.
  • How do I handle objects with shared references in React?
    2 projects | reddit.com/r/reactjs | 1 Jun 2022
    You could create explicitly immutable references and state by using a tool like Immer.js or Immutable.js and do something like your example using their API.
  • Synchronized immutable state with time travel
    5 projects | dev.to | 5 Apr 2022
    We have got far, starting with initial attempts using abstractions like immutable which has a severe downside with interoperability. Then we went over to manually cloning objects and arrays using built-in language features like the spread operator, which makes it super unreadable to change complex structures. For example, nested objects or arrays with objects because you have to go inside whatever you want to change and then clone every object on your path to keep the object immutable.
  • Hooks Considered Harmful
    8 projects | news.ycombinator.com | 21 Mar 2022
    Using ImmutableJS [1] for all the state variables avoids the identity issues he raises.

    [1] https://immutable-js.com

  • Learn React the hard way
    4 projects | dev.to | 6 Mar 2022
    React reshapes modern web frontend with its declarative UI paradigm (rethinking best practice), and it embraces FP at heart. Stateless components, side effect segregation etc all good stuff. Then you encounter immutability, and got amazed by the power of it - time travel debugging. Followed by an unstoppable learning path of immutable.js, immer.js etc. At the end of day, we all realized that JavaScript is a multi-paradigm language.
  • Introduction to Functional Programming in JavaScript
    5 projects | dev.to | 8 Jan 2022
    There are also libraries such as Immer and Immutable that were created to make our lives easier while dealing with immutability in JavaScript.
  • Lessons Learned from AOC 2021
    7 projects | dev.to | 31 Dec 2021
    I have been a huge proponent of functional programming in JavaScript. As seen throughout this series, the Haskell solutions can almost always be translated into decent looking JavaScript code. But as some have pointed out, the lack of certain features such as persistent data structures or tail call optimization makes it impossible to implement many real world applications. Using something like ImmutableJS would probably help, but replacing every single data structure with something from a library is objectionable.
  • How to handle "mutable state" in a pure functional way
    3 projects | reddit.com/r/functionalprogramming | 31 Dec 2021
    Use persistent immutable data structures (as implemented in, for instance, mori or Immutable.js) to represent the state. As much as possible, push calculations into referentially transparent functions (i.e., input depends purely on output) which take persistent data. Write the interactions with the real world in imperative style.

What are some alternatives?

When comparing lodash and immutable-js you can also consider the following projects:

ramda - :ram: Practical functional Javascript

underscore - JavaScript's utility _ belt

lazy.js - Like Underscore, but lazier

mori - ClojureScript's persistent data structures and supporting API from the comfort of vanilla JavaScript

RxJS

Immer - Create the next immutable state by mutating the current one

Sugar - A Javascript library for working with native objects.

Mout - Modular JavaScript Utilities

immutability-helper - mutate a copy of data without changing the original source

jQuery - jQuery JavaScript Library