npm-pkg-info
Universal npm info model.
Install
npm install --save npm-pkg-info
Use Case
const NpmPackage = NpmPackage
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
Param | Type | Description |
---|---|---|
distTag | string |
dist-tag |
npmPackage.getInfoByVersion(ver)
get info by specific version
Kind: instance method of NpmPackage
Param | Type | Description |
---|---|---|
ver | string |
version |
npmPackage.getLatestInfoByMajorVer(majorVer)
get latest info by the major version
Kind: instance method of NpmPackage
Param | Type | Description |
---|---|---|
majorVer | number |
major 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
Param | Type | Description |
---|---|---|
packageName | string |
name of the npm package |
registry | string |
registry url |