Node.js package.json version number fetcher
$ npm install version
var version = require('version');
version.fetch('express', function(error, version) {
if (error) {
console.error(error);
} else {
console.log('express current version: ', version);
};
});
var version = require('version');
version.fetch('express', { from : /^/gi, to : "v" }, function(error, version) {
if (error) {
console.error(error);
} else {
console.log('express current version with formating:', version);
};
});
var version = require('version');
version.fetch(function(error, version) {
if (error) {
console.error(error);
} else {
console.log('`version` package current version:', version);
};
});