By the end of this, developers should be able to:
- Find an NPM package that solves a common problem.
- Write a script that uses an NPM package.
- Fork and clone this repository.
- Install dependencies with
npm install
.
Read through each section, complete each lab, and submit answers in lib/practice.md via pull request.
Node modules are simply packaged up pieces of code that assist us in various ways. Any functions exported by that module become available to us when we require said module. Variables local to the module's code remain private.
NPM is Node's default package manager. Not only does it allow developers to share their open source packages, but it allows us to download and keep updated with these packages.
Thinking back to Ruby, we know that as a language, it is really convenient for list processing versus JavaScript. How can we do something similar in Node?
Do some research and find a Node module that is designed to help with list processing/enumeration. Once you've found one you've deemed worthy, install it to this repository by running (from the command line)
npm install --save <package-name>
In your lib/practice.md, please make note of which package you decided on.
Find the most popular packages on NPM and note, in your own words, three of the packages. Questions to consider while you research:
- What problem does this package solve?
- How can I use this package in my own code? What steps are involved?
- How well-maintained is this package? What criteria did I use to decide?
Please leave these responses in lib/practice.md.
Take your randomizer script from ga-wdi-boston/node-api. Change it to use packages from NPM. You will need to identify what code you want to replace with a package and then find an appropriate package using Google or the NPM registry.
If the enumeration package you previously installed was not lodash
,
please go ahead and install lodash using npm install --save lodash
Here are a few things you might try:
- Use
lodash
to iterate through collections. - Find a randomizer package to randomly sort an array.
- Find a package to colorize terminal output and make your output pretty.
- Decorate your output with emojis!
Careful when using packages in your font-end projects. Some of them are very large!
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].