Skip to content

Instantly share code, notes, and snippets.

@arian
Created March 1, 2012 23:18
Show Gist options
  • Save arian/1953954 to your computer and use it in GitHub Desktop.
Save arian/1953954 to your computer and use it in GitHub Desktop.
Analyze NPM package data
var fs = require('fs');
var packages = JSON.parse(fs.readFileSync('/home/arian/.npm/-/all/.cache.json'));
var total = 0, zeros = 0, alphas = 0;
for (var name in packages){
var package = packages[name],
versions = package.versions,
version;
for (var k in versions) version = k;
if (version != null){
total++;
if (version.slice(0, 1) == '0') zeros++;
if (version.slice(0, 3) == '0.0') alphas++;
}
}
console.log('total:', total);
console.log('0.x :', zeros, zeros / total);
console.log('0.0.x:', alphas, alphas / total);
@arian
Copy link
Author

arian commented Mar 1, 2012

current results:

total: 7622
0.x  : 6635 0.870506428758856
0.0.x: 3106 0.4075045919706114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment