
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
The npm-name package is used to check the availability of package names on the npm registry. It helps developers to determine if a particular package name is already taken or if it is available for use.
Check single package name
This feature allows you to check if a single package name is available on the npm registry. The code sample demonstrates how to use the npm-name package to check the availability of 'some-package-name'.
const npmName = require('npm-name');
(async () => {
const isAvailable = await npmName('some-package-name');
console.log(isAvailable ? 'Available' : 'Taken');
})();
Check multiple package names
This feature allows you to check the availability of multiple package names at once. The code sample shows how to check the availability of 'package-one' and 'package-two' using the npm-name package.
const npmName = require('npm-name');
(async () => {
const result = await npmName.many(['package-one', 'package-two']);
console.log(result);
})();
Check scoped package name
This feature allows you to check the availability of a scoped package name. The code sample demonstrates how to check if '@scope/some-package-name' is available on the npm registry.
const npmName = require('npm-name');
(async () => {
const isAvailable = await npmName('@scope/some-package-name');
console.log(isAvailable ? 'Available' : 'Taken');
})();
The npm-name-cli package is a command-line interface tool for checking the availability of npm package names. While npm-name is a library that can be integrated into other Node.js applications, npm-name-cli is specifically designed for use in the terminal, making it a good choice for developers who prefer command-line tools.
Check whether a package or organization name is available on npm
npm install npm-name
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
}
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<boolean>
of whether the given name is available.
Type: string
The name to check.
Type: object
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.
Check whether multiple package/organization names are available (not registered) on npm.
Returns a Promise<Map>
of name and status.
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
Type: string[]
Multiple names to check.
Type: object
Same as npmName()
.
FAQs
Check whether a package or organization name is available on npm
The npm package npm-name receives a total of 167,171 weekly downloads. As such, npm-name popularity was classified as popular.
We found that npm-name demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.