NPM.getLatestVersion()

Look up the version string for the latest published version of the specified NPM package.

This fetches uses information directly from the NPM registry's Couch database.

Usage

Hover over inputs/exits for more info.

var NPM = require('machinepack-npm');


// Look up the version string for the latest published version of the specified NPM package.

NPM.getLatestVersion({

packageName: 'browserify',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No package exists on the public NPM registry with the specified name.

packageNotFound: function () {

 

},

// The package.json string for the specified package could not be parsed as JSON.

couldNotParse: function () {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

packageName required

The unique name of the NPM package.

'browserify'

Exits

error

An unexpected error occurred.

packageNotFound

No package exists on the public NPM registry with the specified name.

couldNotParse

The package.json string for the specified package could not be parsed as JSON.

success

OK.

'1.0.0'