You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check whether a package or organization name is available on npm
Install
npm install npm-name
Usage
importnpmNamefrom'npm-name';// Check a package nameconsole.log(awaitnpmName('chalk'));//=> false// Check an organization nameconsole.log(awaitnpmName('@ava'));//=> falseconsole.log(awaitnpmName('@abc123'));//=> truetry{awaitnpmName('_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<boolean> 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.