Has anyone implemented Underscore or Lodash into their existing AngularJS project for a performance boost? If so:
有没有人在现有的AngularJS项目中实施Underscore或Lodash以提升性能?如果是这样:
- Were the changes something noticeable or something that you would recommend?
- Which functionality from Lodash did you find the most benefits?
这些变化是否值得注意或者您会推荐什么?
Lodash的哪些功能让您获得最大的好处?
I have not actually played with Lodash before and was looking into learning it. But I typically like to learn something and then actually use it shortly after, so that the concepts stick better. If I'll get some good benefits out of implementing Lodash, then I think it would be a good time to learn it now.
我以前没有和Lodash玩过,并且正在研究它。但我通常喜欢学习一些东西,然后不久就会使用它,这样概念就更好了。如果我从实施Lodash中获得一些好处,那么我认为现在是学习它的好时机。
I do typically need to perform functions such as filtering or finding an object inside some sort of collection, so I'm thinking that's where I would utilize it the most.
我通常需要执行诸如过滤或在某种集合中查找对象之类的功能,所以我认为这是我最能利用它的地方。
1 个解决方案
#1
3
Well they have really different purposes.
那么他们有着不同的目的。
Angular is to build an application. It helps you to structure your code and separate responsibilities between your components (modules, controllers, services, directives, routers).
Angular是构建一个应用程序。它可以帮助您构建代码并在组件(模块,控制器,服务,指令,路由器)之间分离职责。
Lodash is nice to manipulate collections, arrays, objects, strings, etc. It helps your code to be shorter, cleaner and probably faster. It is really well tested and documented. In my opinion, it makes your job simpler.
Lodash非常适合处理集合,数组,对象,字符串等。它可以帮助您的代码更短,更清晰,更快。它经过了很好的测试和记录。在我看来,它使你的工作更简单。
I use Lodash for 4 years now. I found it useful in all my projects (Backbone, Angular, JavaScript, node, in the unit tests, in the build configuration files (Grunt, Gulp, Webpack)).
我现在用Lodash已经4年了。我发现它在我的所有项目中都很有用(Backbone,Angular,JavaScript,节点,单元测试,构建配置文件(Grunt,Gulp,Webpack))。
PS: Lodash is also a must-have to go into functional programming in JavaScript.
PS:Lodash也是进入JavaScript函数式编程的必备工具。
Edit: Example of searching that you can't easily achieve without Lodash
编辑:没有Lodash你不能轻易实现的搜索示例
#1
3
Well they have really different purposes.
那么他们有着不同的目的。
Angular is to build an application. It helps you to structure your code and separate responsibilities between your components (modules, controllers, services, directives, routers).
Angular是构建一个应用程序。它可以帮助您构建代码并在组件(模块,控制器,服务,指令,路由器)之间分离职责。
Lodash is nice to manipulate collections, arrays, objects, strings, etc. It helps your code to be shorter, cleaner and probably faster. It is really well tested and documented. In my opinion, it makes your job simpler.
Lodash非常适合处理集合,数组,对象,字符串等。它可以帮助您的代码更短,更清晰,更快。它经过了很好的测试和记录。在我看来,它使你的工作更简单。
I use Lodash for 4 years now. I found it useful in all my projects (Backbone, Angular, JavaScript, node, in the unit tests, in the build configuration files (Grunt, Gulp, Webpack)).
我现在用Lodash已经4年了。我发现它在我的所有项目中都很有用(Backbone,Angular,JavaScript,节点,单元测试,构建配置文件(Grunt,Gulp,Webpack))。
PS: Lodash is also a must-have to go into functional programming in JavaScript.
PS:Lodash也是进入JavaScript函数式编程的必备工具。
Edit: Example of searching that you can't easily achieve without Lodash
编辑:没有Lodash你不能轻易实现的搜索示例