npm-vers

Retrieve all versions from a module with helper to get the latestRelease and latestPreRelease

Usage no npm install needed!

<script type="module">
  import npmVers from 'https://cdn.skypack.dev/npm-vers';
</script>

README

npm-vers Build Status

Retrieve all versions from a module with helper to get the latestRelease and latestPreRelease

Getting Started

Install the module with: npm install npm-vers

var npmVersions = require('npm-vers');
npmVersions('npmi', function (err, result) {
  if (err) {
    throw err;
  }
  
  console.log(result);
});

Documentation

 result.current

Type: SemVer object
Content: current version (latest) on registry.npmjs.org

 result.versions

Type: Array
Content: current version (latest) on registry.npmjs.org

 result.latestRelease

Type: SemVer object (or null)
Content: latest clean release version on registry.npmjs.org

 result.latestPreRelease

Type: SemVer object (or null)
Content: latest prerelease or build version on registry.npmjs.org

Examples

For instance:
['0.0.0', '0.0.1-SNAPSHOT', '0.0.1', '0.0.2-alpha']
Will result in:

var npmVersions = require('npm-vers');
npmVersions('foo', function (err, result) {
  if (err) {
    throw err;
  }
  
  // result.current = 0.0.2-alpha
  // result.versions = ['0.0.0', '0.0.1-SNAPSHOT', '0.0.1', '0.0.2-alpha']
  // result.latestRelease = 0.0.1
  // result.latestPreRelease = 0.0.2-alpha
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

0.1.0 - 18/06/2014

License

Copyright (c) 2014 Maxime Tricoire. Licensed under the MIT license.