# registry-resolve

> Resolve a package version from an npm-like registry

Latest version **0.2.0** (published 2016-08-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install registry-resolve
pnpm add registry-resolve
yarn add registry-resolve
bun add registry-resolve
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2016-08-30 |
| First published | 2016-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Gustavo Sillero |
| Maintainers | sillero |
| Keywords | resolve, package, version, npm |

## Links

- npm: https://www.npmjs.com/package/registry-resolve
- Repository: https://github.com/sillero/registry-resolve
- Homepage: https://github.com/sillero/registry-resolve#readme
- Issues: https://github.com/sillero/registry-resolve/issues
- npm.io page: https://npm.io/package/registry-resolve

## Dependencies (2)

- [semver](https://npm.io/package/semver.md) ^5.1.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^1.5.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2016-08-30
- 0.1.3 — 2016-04-10
- 0.1.2 — 2016-04-10
- 0.1.1 — 2016-04-10
- 0.1.0 — 2016-04-09

## README

# registry-resolve
Resolve a package version from an npm-like registry.  
Inspired by https://github.com/grncdr/resolve-package-versions

## Installation
`npm install registry-resolve`

## Usage
```javascript
const resolve = require('registry-resolve');

// `resolve` will contact the registry (default is npm) and 
// try to match the provided package version, returning a
// `Promise`.
//
// If there's a match, the `Promise` will resolve with
// a string containing the matched version number.
//
// If no version is matched, the `Promise` will resolve
// with  `null`

resolve(
  {
    name: 'autoprefixer',
    version: '^5.1.0',                  // optional, defaults to '*'
    registry: 'http://my.registry.url/' // optional, defaults to 'http://registry.npmjs.com/'
  }
)
.then(version => { console.log(version); }); // > '5.2.0'

// or
resolve('autoprefixer') // version defaults to '*'
  .then(version => { console.log(version); }); // > '6.3.6'

// or
resolve(
  {
    name: 'autoprefixer',
    full: true // optional, the response is the full package details
  }
).then(pkg => { console.log(pkg) })
/** trimmed output
{ name: 'autoprefixer',
  version: '6.4.0',
  description: 'Parse CSS and add vendor prefixes to CSS rules using values from the Can I Use website',
  keywords: [ 'autoprefixer', 'css', 'prefix', 'postcss', 'postcss-plugin' ],
  author: { name: 'Andrey Sitnik', email: 'andrey@sitnik.ru' },
  license: 'MIT',
  repository:
   { type: 'git',
     url: 'git+https://github.com/postcss/autoprefixer.git' },
  dependencies: ...
  ...
}
**/

```

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