Introduction to Lodash

John Lindquist
InstructorJohn Lindquist

Share this video with your friends

Send Tweet
Published 8 years ago
Updated 3 years ago

Lodash is a toolkit of Javascript functions that provides clean, performant methods for manipulating objects and collections. It is a "fork" of the Underscore library and provides additional functionality as well as some serious performance improvements. If you aren't using Lodash, you should be.

Narrator: [00:00] Lo-Dash is an insanely helpful set of utilities for both for the browser and node. Let's say for example I want to get the first three values out of this set of people. I can just say first three, run it, and I can get the first three people.

[00:14] If I want to sort by their names, I can just say sort by name. You can see now it's sorted by name. If I want it to sort by their age, I can now sort by their age. If I only want to get a new array of just the names and I don't care about the values, I could get that. I could then sort them and get those.

[00:38] If I only wanted to get the people who are of the age of 22, I could say age 22 and return all those people. Again, do something like a sort. Or if I wanted to get the oldest person, I could say max and check the age and get the oldest person. Or if I get the youngest person, let's say min and age, and on and on and on.

[01:02] Lo-Dash does have a ton of features. If you want to read about all of them, go their API documentation at Lo-Dash.com/docs. If you're familiar with other libraries like Underscore, which Lo-Dash came from, or something like Sugar JS. These are all very similar but Lo-Dash has seen the greatest adoption in the community due to its performance and features and other things like that.

[01:26] We'll be doing a lot more videos on Lo-Dash as well as simply using Lo-Dash in videos, because it's such a great library.

Deryck
Deryck
~ 8 years ago

I don't like linking off-site, but I think anyone that is either unsure of using lodash vs. underscore (or others), or really any developer with at least an intermediate understanding of JS, needs to watch this video.

John-David Dalton, the Lo-Dash creator, describes how his library is built with optimizations that, in some cases, even outperform some native counterparts: https://www.youtube.com/watch?v=NthmeLEhDDM&list=LLuyw3Di40FSMiYsdksLkKDg