0.1.0 • Published 8 years ago

npm-count v0.1.0

Weekly downloads
9
License
MIT
Repository
github
Last release
8 years ago

Npm Count

a npm/download-counts wrapper

API Documentation

Usage

npm install npm-count
import npmCount from 'npm-count';

npmCount.fetchLastDay()
.then((lastday) => (
  npmCount.fetchTrending(lastday)
  .then((trending) => {
    // sort by downloads desc, name asc
    trending.sort((a, b) => {
      switch (true) {
        case a.downloads > b.downloads: return -1;
        case a.downloads < b.downloads: return 1;
        default:
          switch (true) {
            case a.name > b.name: return -1;
            case a.name < b.name: return 1;
            default: return 0;
          }
      }
    });

    const top10 = trending.slice(0, 10).map(({ name, downloads }) => ({ name, downloads }));
    console.log(lastday, top10);
  })
));

becomes:

// 2016-03-09
// [ { name: 'accepts', downloads: 383431 },
//   { name: 'js-yaml', downloads: 355826 },
//   { name: 'tough-cookie', downloads: 320130 },
//   { name: 'babel-core', downloads: 182993 },
//   { name: 'ast-types', downloads: 171452 },
//   { name: 'babylon', downloads: 167286 },
//   { name: 'recast', downloads: 159671 },
//   { name: 'invariant', downloads: 100457 },
//   { name: 'ansi-escapes', downloads: 93092 },
//   { name: 'babel-types', downloads: 86348 } ]

Development

git clone https://github.com/59naga/npm-count.git
cd npm-count
npm test

License

MIT

0.1.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.0.1-beta.2

9 years ago

0.0.1-beta.1

9 years ago

0.0.1-beta

9 years ago

0.0.1-alpha

9 years ago

0.0.0

9 years ago

0.0.0-beta.4

9 years ago

0.0.0-beta.3

9 years ago

0.0.0-beta.2

9 years ago

0.0.0-beta.1

9 years ago

0.0.0-beta.0

9 years ago

0.0.0-alpha

9 years ago