npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lodown-julia

v1.0.0

Published

An npm functional programming library project

Downloads

4

Readme

lodown

An npm functional programming library project

  1. Fork this repository to your own GitHub account.

  2. Clone your forked version of the lodown repository to a new Cloud9 workspace or locally if you prefer.

  3. To create a package.json configuration file for our lodown library, from the command-line, run the command:

     npm init
  4. IMPORTANT CONFIGURATION: Fill in the prompts with your own details:

    1. When asked for test command, enter:

      istanbul cover _mocha -- test/ -R spec

    2. When asked for your git repository, you will probably be given the correct url as the default, so just select this by pressing return, otherwise, provide your forked GitHub repository's url.

  5. Install the required test libraries by running the following command:

     npm install i -D mocha chai sinon istanbul
  6. Write your tests in the file test/index.spec.js. Check out the chai api for and be careful when asserting/expecting against complex types - you'll have to make use of the .eql api, and not .equal. For example:

     expect(lodown.filter([1, 2, 3], function(value) { return value > 2; } )).to.eql([3]);
  7. Implement your library in the file index.js. Remember that index.js is a Node.js module, so you must export your API using, for example:

     module.exports.each = each;
  8. To run your tests, run the following command:

     npm test
  9. Check the console output for passes and failures.

  10. Preview (Cloud9) or open the file at coverage/lcov-report/index.html for your coverage report. Make certain all lines of code are traversed in your tests!

Solve

Using the file at test/fixtures/customers.json, and utilizing your lodown library, write functions that take the Array of customers and return the following:

  1. how many males, how many females
  2. oldest customer, youngest customer
  3. average balance
  4. how many customer's names begin with some letter
  5. how many customer's friend's names begin with some letter
  6. how many customers are friends
  7. how many customers have friends in common
  8. most common tags

Resources:

Docs

  1. https://mochajs.org
  2. http://chaijs.com/api/bdd/
  3. http://sinonjs.org/docs/#spies-api

Reading

  1. http://marcofranssen.nl/using-mocha-chai-sinon-to-test-node-js/
  2. http://stackoverflow.com/questions/19298118/what-is-the-role-of-describe-in-mocha
  3. http://www.vapidspace.com/coding/2014/10/29/code-coverage-metrics-with-mocha-and-istanbul/

Quick Videos

  1. https://egghead.io/lessons/javascript-how-to-write-a-javascript-library-setting-up-unit-testing-with-mocha-and-chai
  2. https://egghead.io/lessons/javascript-how-to-write-a-javascript-library-unit-testing-with-mocha-and-chai