var npm = require('npm');
var asyncMap = require('slide').asyncMap;

exports.getLatestVersions = getLatestVersions;
// Query npm for the latest versions of a list of packages
// This API internally fetches the latest changes from npm automatically
// so we don't have to worry about timestamps or cache invalidation.
//
// `names` is an array of npm package names
function getLatestVersions(names, callback) {
  // Fetch the meta.dist-tags.latest value for all the packages in parallel
  asyncMap(names, function (name, callback) {
    npm.registry.get(name, function (err, data) {
      if (err) {
        callback(err);
        return;
      }

      var latest = data['dist-tags'].latest;
      callback(null, { latest: latest, updated: new Date(data.time[latest]) });
    });
  }, function (error, versions) {
    if (error) {
      callback(error);
      return;
    }

    // When done combine the two arrays into an object for easy lookup.
    var latest = {};
    names.forEach(function (name, i) {
      latest[name] = versions[i];
    });

    callback(null, latest);
  });
}


// Export load
exports.load = npm.load;

@@ -687,24 +687,26 @@
 test;%0A      
+  
 callback(nul
@@ -762,16 +762,42 @@
 latest%5D)
+, isPatch: isPatch(latest)
  %7D);%0A   
@@ -1108,16 +1108,141 @@
  %7D);%0A%7D%0A%0A
+function isPatch(version) %7B%0A  var regex = new RegExp('%5B0-9%5D+.%5B0-9%5D+.(%5B0-9%5D+)');%0A  return version.match(regex)%5B1%5D !== '0';%0A%7D%0A%0A
 %0A// Expo

Add support for isPatch