Book Image

Lo-Dash Essentials

By : Adam Boduch
Book Image

Lo-Dash Essentials

By: Adam Boduch

Overview of this book

Table of Contents (15 chapters)
Lo-Dash Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Node.js


In the closing section of this chapter, we'll turn our attention to writing Lo-Dash code for the backend. This of course means installing Lo-Dash as a Node.js package.

Installing the Lo-Dash package

Assuming you already have Node installed, since you had to do so in order to run the grunt command in the RequireJS examples, you should have an npm command on your system. If that's the case, installation is incredibly easy:

npm install -g lodash

This will install Lo-Dash globally, meaning it's accessible to any other Node project that wishes to use it. This is probably a good idea since Lo-Dash is a library after all. To verify that the installation was a success, you can run the following command:

node -e "require('lodash');"

If you see a long error message, it means that something went wrong at the time of installation. If it exists silently, you're all set.

Creating a simple command

To get our hands dirty with Node.js along with Lo-Dash development, let's create a simple command that...