https://github.com/sindresorhus/npm-name
  
  
    Check whether a package or organization name is available on npm 
    https://github.com/sindresorhus/npm-name
  
        Last synced: 6 months ago 
        JSON representation
    
Check whether a package or organization name is available on npm
- Host: GitHub
 - URL: https://github.com/sindresorhus/npm-name
 - Owner: sindresorhus
 - License: mit
 - Created: 2014-04-13T19:07:42.000Z (over 11 years ago)
 - Default Branch: main
 - Last Pushed: 2024-02-10T18:55:17.000Z (over 1 year ago)
 - Last Synced: 2025-05-12T03:26:31.428Z (6 months ago)
 - Language: JavaScript
 - Homepage:
 - Size: 69.3 KB
 - Stars: 170
 - Watchers: 5
 - Forks: 27
 - Open Issues: 1
 - 
            Metadata Files:
            
- Readme: readme.md
 - License: license
 
 
Awesome Lists containing this project
- awesome-nodejs - npm-name - Check a package name's availability on npm.  (Repository / NPM)
 - awesome-nodejs-cn - npm-name - **star:168** 检查 npm 上的包名是否可用 (包 / 命令行程序)
 - awesome-nodejs - npm-name - Check a package name's availability on npm. (Packages / Command-line apps)
 - awesome-nodejs-cn - npm-name - 在npm上检查软件包名称的可用性. (目录 / 命令行应用)
 - awesome-nodejs - npm-name - Check whether a package name is available on npm - ★ 81 (Command-line apps)
 - awesome-nodejs-cn - npm-name - 检查包名在 npm 上是否可用 (包 / 命令行程序)
 - fucking-awesome-nodejs - npm-name - Check a package name's availability on npm. (Packages / Command-line apps)
 - fucking-awesome-nodejs - npm-name - Check a package name's availability on npm. (Packages / Command-line apps)
 - awesome-nodejs - npm-name - 检查软件包或组织名称在npm上是否可用 (Uncategorized / Uncategorized)
 
README
          # npm-name
> Check whether a package or organization name is available on npm
## Install
```sh
npm install npm-name
```
## Usage
```js
import npmName from 'npm-name';
// Check a package name
console.log(await npmName('chalk'));
//=> false
// Check an organization name
console.log(await npmName('@ava'));
//=> false
console.log(await npmName('@abc123'));
//=> true
try {
	await npmName('_ABC');
} catch (error) {
	console.log(error.message);
	// Invalid package name: _ABC
	// - name cannot start with an underscore
	// - name can no longer contain capital letters
}
```
## API
### npmName(name, options?)
Check whether a package/organization name is available (not registered) on npm.
An organization name should start with `@` and should not be a scoped package.
Returns a `Promise` of whether the given name is available.
#### name
Type: `string`
The name to check.
#### options
Type: `object`
##### registryUrl
Default: User's configured npm registry URL.
THe registry URL to check name availability against.
**Note:** You're unlikely to need this option. Most use-cases are best solved by using the default. You should only use this option if you need to check a package name against a specific registry.
### npmNameMany(names, options?)
Check whether multiple package/organization names are available (not registered) on npm.
Returns a `Promise` of name and status.
```js
import {npmNameMany} from 'npm-name';
const result = await npmNameMany(['chalk', '@sindresorhus/is', 'abc123']);
console.log(result.get('chalk'));
//=> false
console.log(result.get('@sindresorhus/is'));
//=> false
console.log(result.get('abc123'));
//=> true
```
#### names
Type: `string[]`
Multiple names to check.
#### options
Type: `object`
Same as `npmName()`.
## Related
- [npm-name-cli](https://github.com/sindresorhus/npm-name-cli) - CLI for this module