Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Node.js package.json version number fetcher
JavaScript
tag: v0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
test
.gitignore
.travis.yml
CHANGELOG.md
README.md
package.json

README.md

version (NodeJS package.json version number fetcher)

Build Status

Installation

$ npm install version

Example (basic)

var version = require('version');

version.fetch('express', function(error, version) {
  if (error) {
    console.error(error);
  } else {
    console.log('express current version: ', version);
  };
});

Example (RegExp formating)

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);
  };
});

Example (Current Projects package.json)

var version = require('version');

version.fetch(function(error, version) {
  if (error) {
    console.error(error);
  } else {
    console.log('`version` package current version:', version);
  };
});
Something went wrong with that request. Please try again.