Wondering what’s next for npm?Check out our public roadmap! »

    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

    Install

    npm i packages-versions

    DownloadsWeekly Downloads

    49

    Version

    2.3.0

    License

    MIT

    Unpacked Size

    20 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar