is-name-taken
v2.0.0
Published
Check if an NPM package name is taken
Downloads
44,433
Maintainers
Readme
Check if an NPM package name is taken.
Validates an NPM package name and then checks if a conflicting package exists. Also accounts for punctuation differences.
Installation
yarn add is-name-taken
npm install is-name-taken
API
import { isTaken, isValid } from "is-name-taken";
// Check if a package name is taken, and if so, return the conflict:
isTaken("ch-alk"); // "chalk"
// If not taken, return false
isTaken("package-that-doesnt-exist"); // false
// If invalid, return true
isTaken("INVALID_NAME"); // true
// Check if a package name is valid
isValid("chalk"); // true
isValid("INVALID_NAME"); // false
Types:
import { Options } from "is-name-taken";
type Options = {
/**
* Maximum milliseconds after a sync to avoid re-syncing
*/
maxAge?: number;
/**
* Setting optimistic to true will skip syncing latest packages from NPM.
* This is faster, but may lead to inconsistencies with recently published packages.
*/
optimistic?: boolean;
};
function isValid(name: string): boolean;
function isTaken(name: string, options?: Options): Promise<string | boolean>;
- all-package-names: Get all NPM package names
- package-name-conflict: Check if NPM package names conflict
- validate-npm-package-name: Give me a string and I'll tell you if it's a valid npm package name
- @bconnorwhite/bob: Bob builds and watches typescript projects.
- @types/validate-npm-package-name: TypeScript definitions for validate-npm-package-name
Related Packages
- package-name-conflict: Check if NPM package names conflict
- all-package-names: Get all NPM package names.
- npm-pd: A CLI dashboard for NPM publishers
- npms-io-client: Isomorphic typed client for npms.io