packages-versions

2.3.0ย โ€ขย Publicย โ€ขย Published

PACKAGES VERSIONS ๐Ÿช

Build Status ย ย  Coverage Status ย ย  All Contributors NPM version ย ย  License ย ย  Top Language ย ย  Code Size ย ย  Code of Conduct PRs Welcome ย ย 

GET ALL VERSIONS OF ANY PACKAGES ๐Ÿ—ƒ ..

I don't intend to make breaking changes to this package ๐Ÿ™Œ๐Ÿป. So, don't be afraid to upgrade โœจ.
I added Opts argument (Optional) to the function for give you more control ๐ŸŽฎ.

Installation

# npm ..
$ npm install packages-versions
# yarn ..
$ yarn add packages-versions

Usage

This is a practical example of how to use.

  // you can use any name for this function.
  // the result is an array of versions in descending order.
  const getPackagesVersions = require ('packages-versions');

  // note: you can use the promise way (then/catch)

  (async () => {
    try {
      let list = await getPackagesVersions('packages-versions');
      console.log(list);
    }catch(err){
      console.log(err) 
    }
  })();
  // Result: 
  // [ '2.1.0', '2.0.0', '1.1.1', '1.1.0', '1.0.1', '1.0.0' ]

  // the same example with reverse opt.
  (async () => {
    try {
      let list = await getPackagesVersions('packages-versions', { reverse: true });
      console.log(list);
    }catch(err){
      console.log(err) 
    }
  })();
  // Result: 
  // [ '1.0.0', '1.0.1', '1.1.0', '1.1.1', '2.0.0', '2.1.0' ]

  // the same example with extract opt.
    try {
      let list = await getPackagesVersions('packages-versions', { extract: { rc: true } });
      console.log(list);
    }catch(err){
      console.log(err) 
    }
  })();
  // Result: // we don't have any rc package.
  // []

Options Ref.

Option Type Descriptio
reverse Boolean Reverse the order of the results (versions array).
extract Object Extract only the type of version you want.

Note: extract can contain one, some or all of these values โ€‹โ€‹in a boolean form (pure: X.X.X, rc: X.X.X-rc, beta: X.X.X-beta, alpha: X.X.X-alpha).

You can combine reverse and extract.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Joel Denning

๐Ÿ“–

imed jaberi

๐Ÿ“– ๐Ÿš‡ ๐Ÿšง ๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

License


MIT

Package Sidebar

Install

npm i packages-versions

Weekly Downloads

13

Version

2.3.0

License

MIT

Unpacked Size

20 kB

Total Files

11

Last publish

Collaborators

  • 3imed-jaberi