Neurotic Programmer Masquerade

    get-version-from-package

    1.1.0 • Public • Published

    get-version-from-package Build Status

    Gets you a given version from a given npm package.

    Usage

    const getVersionFromPackage = require('get-version-from-package')
     
    (async () => {
      const typeScriptVersions = await getVersionFromPackage('typescript')
     
      console.log(typeScriptVersions)
      // {
      //   latest: '4.0.5',
      //   next: '4.1.0-dev.20201101',
      //   beta: '4.1.0-beta',
      //   rc: '4.0.1-rc',
      //   insiders: '4.0.2-insiders.20200818',
      //   'tag-for-publishing-older-releases': '3.6.5',
      //   dev: '3.9.4'
      // }
     
      const { latest, next, beta } = await getVersionFromPackage('typescript')
     
      console.log('Latest version', latest) // 5.3.2
      console.log('Next version', next) // 5.0.0-rc.6
      console.log('Beta version', beta) // 4.1.0-beta
    })()

    API

    getPackageVersion(pkgName, outputError?)

    pkgName

    Type: string

    The package name on npm.

    outputError

    Type: boolean
    Default: false

    Set to true if you need the error message.

    License

    MIT (c) Cezar Augusto.

    Install

    npm i get-version-from-package

    DownloadsWeekly Downloads

    0

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    3.76 kB

    Total Files

    4

    Last publish

    Collaborators

    • cezaraugusto