npm-taken

0.2.0 • Public • Published

npm-taken

Find out if a module name is already in the npm registry.

Build Status Coverage Status Code Climate Dependency Status devDependency Status

NPM

Usage

var npmTaken = require('npm-taken');
 
npmTaken('my-awesome-package-name', function(err, taken) {
  if (err) {
    // Uh Oh! Something bad happened...
  }
  if (taken === false) {
    // It's not taken... Hurry, make something cool!
  }
  if (taken) {
    // somebody beat you to it!
    // taken will be an object containing all kinds of metadata about the existing package.
  }
});

API

npmTaken(packageName, [registryUrl,] callback)

packageName

Required
Type: string

The package name you want.

registryUrl

Optional
Type: string

Use an alternate registry to perform the lookup. Default is https://registry.npmjs.com/.

callback

Optional
Type: function(err, response)

Will be called with:

  • err: if there was some problem communicating with the registry, null otherwise.
  • response: will be false if the name is available, otherwise it will be an object containing metadata about the existing module.

License

MIT © James Talmage

Package Sidebar

Install

npm i npm-taken

Weekly Downloads

0

Version

0.2.0

License

MIT

Last publish

Collaborators

  • jamestalmage