Is there any use in using Lodash in an AngularJS project?

Has anyone implemented Underscore or Lodash in their existing AngularJS project to improve performance? If yes:

  • Were any changes noticeable or something that you would recommend?
  • What functionality from Lodash did you find most useful?

I have not played with Lodash before and studied it. But I usually like to study something, and then actually use it shortly afterwards to keep the concepts better. If I get good value from the Lodash implementation, then I think now is the time to study it.

I usually need to perform functions such as filtering or searching for an object within a collection, so I think where I will use it the most.

+5
source share
1 answer

Well, they really have different goals.

Angular is about building an application. It helps to structure your code and individual responsibilities between your components (modules, controllers, services, directives, routers).

Lodash is nice to manipulate collections, arrays, objects, strings, etc. This helps your code to be shorter, cleaner, and probably faster. It is really well tested and documented. In my opinion, this simplifies your work.

I have been using Lodash for 4 years now. I found it useful in all my projects (Backbone, Angular, JavaScript, node, in unit tests, in assembly configuration files (Grunt, Gulp, Webpack)).

PS: Lodash is also required for functional programming in JavaScript.

Edit: An example of a search that you cannot easily achieve without Lodash

+3
source

Source: https://habr.com/ru/post/1247288/


All Articles