# package-json-plus

> Get metadata of a package from the npm registry

Latest version **4.0.2** (published 2017-05-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install package-json-plus
pnpm add package-json-plus
yarn add package-json-plus
bun add package-json-plus
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2017-05-10 |
| First published | 2017-05-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Youthink |
| Maintainers | youthink |
| Keywords | npm, registry, package, pkg, package.json, json, module, scope, scoped |

## Links

- npm: https://www.npmjs.com/package/package-json-plus
- Repository: https://github.com/Youthink/package-json-plus
- Homepage: https://github.com/Youthink/package-json-plus#readme
- Issues: https://github.com/Youthink/package-json-plus/issues
- npm.io page: https://npm.io/package/package-json-plus

## Dependencies (4)

- [got](https://npm.io/package/got.md) ^6.7.1
- [semver](https://npm.io/package/semver.md) ^5.1.0
- [registry-url](https://npm.io/package/registry-url.md) ^3.0.3
- [registry-auth-token](https://npm.io/package/registry-auth-token.md) ^3.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 4.0.2 (latest) — 2017-05-10

## README

# package-json-plus [![Build Status](https://travis-ci.org/Youthink/package-json-plus.svg?branch=master)](https://travis-ci.org/Youthink/package-json-plus)

> Get metadata of a package from the npm registry

## How is this different from [package-json](https://github.com/sindresorhus/package-json)?

This fork adds this feature:

You can specify npm registry,even without scope.

Please refer to the usage.


## Install

**npm**
```
$ npm install --save package-json-plus
```

**yarn**
```
$ yarn add package-json-plus
```


## Usage

```js
const packageJson = require('package-json-plus');

packageJson('ava').then(json => {
	console.log(json);
	//=> {name: 'ava', ...}
});

// Also works with scoped packages
packageJson('@sindresorhus/df').then(json => {
	console.log(json);
	//=> {name: '@sindresorhus/df', ...}
});

// You can specify npm registry
packageJson('ava', {registryUrl: 'http://r.cnpmjs.org/'}).then(json => {
	console.log(json);
	//=> {name: 'ava', ...}
});
```


## API

### packageJson(name, [options])

#### name

Type: `string`

Name of the package.

#### options

Type: `Object`

##### version

Type: `string`<br>
Default: `latest`

Package version such as `1.0.0` or a [dist tag](https://docs.npmjs.com/cli/dist-tag) such as `latest`.

The version can also be in any format supported by the [semver](https://github.com/npm/node-semver) module. For example:

- `1` - get the latest `1.x.x`
- `1.2` - get the latest `1.2.x`
- `^1.2.3` - get the latest `1.x.x` but at least `1.2.3`
- `~1.2.3` - get the latest `1.2.x` but at least `1.2.3`

##### registryUrl

Type: `string`

Specify npm registry.

##### fullMetadata

Type: `boolean`<br>
Default: `false`

By default, only an abbreviated metadata object is returned for performance reasons. [Read more.](https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md)

##### allVersions

Type: `boolean`<br>
Default: `false`

Return the [main entry](https://registry.npmjs.org/ava) containing all versions.


## Authentication

Both public and private registries are supported, for both scoped and unscoped packages, as long as the registry uses either bearer tokens or basic authentication.


## License

MIT

---
_Source: https://npm.io/package/package-json-plus · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
