Socket
Book a DemoInstallSign in
Socket

npm-pkg-info

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-pkg-info

Universal npm info model

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

npm-pkg-info

npm version

Universal npm info model.

Install

npm install --save npm-pkg-info

Use Case

const NpmPackage = require('npm-pkg-info')
NpmPackage.fromRemote('react').then(info => {
  console.log(info.name) // react
})

PackageInfo

The structure of a package info:

{
    // original npm info
    name: '',
    description: '',
    distTags: '',
    versions: {
    },
    readme: '',
    homepage: '',
    maintainers: [
    ],
    time: {
    },
    author: {
    },
    repository: {
    },
    license: '', 
    keywords: [],
    // extension
    latest: {} // info of latest dist-tag version
}

API

Api generated by jsdoc2md.

NpmPackage

Class for npm package info

Kind: global class

npmPackage.getInfoByDistTag(distTag)

get info by dist-tag

Kind: instance method of NpmPackage

ParamTypeDescription
distTagstringdist-tag

npmPackage.getInfoByVersion(ver)

get info by specific version

Kind: instance method of NpmPackage

ParamTypeDescription
verstringversion

npmPackage.getLatestInfoByMajorVer(majorVer)

get latest info by the major version

Kind: instance method of NpmPackage

ParamTypeDescription
majorVernumbermajor number of a version

npmPackage.getLatestVersionsByMajor()

get latest versions of all major verions

Kind: instance method of NpmPackage

NpmPackage.fromRemote(packageName, registry)

create package instance by remote request from registry

Kind: static method of NpmPackage

ParamTypeDescription
packageNamestringname of the npm package
registrystringregistry url

FAQs

Package last updated on 29 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts