{"id":13453590,"url":"https://github.com/sindresorhus/npm-name","last_synced_at":"2025-05-16T12:10:20.229Z","repository":{"id":15994075,"uuid":"18737287","full_name":"sindresorhus/npm-name","owner":"sindresorhus","description":"Check whether a package or organization name is available on npm","archived":false,"fork":false,"pushed_at":"2024-02-10T18:55:17.000Z","size":71,"stargazers_count":170,"open_issues_count":1,"forks_count":27,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-12T03:26:31.428Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2014-04-13T19:07:42.000Z","updated_at":"2025-03-26T06:33:41.000Z","dependencies_parsed_at":"2022-08-30T09:42:00.163Z","dependency_job_id":"18532057-6c26-4903-b00d-dd2f309980c4","html_url":"https://github.com/sindresorhus/npm-name","commit_stats":{"total_commits":92,"total_committers":18,"mean_commits":5.111111111111111,"dds":0.2717391304347826,"last_synced_commit":"9a84fe9878b270ecdb53b8c0e3cb03b42c070964"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fnpm-name","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fnpm-name/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fnpm-name/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fnpm-name/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/npm-name/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254527100,"owners_count":22085919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T08:00:43.906Z","updated_at":"2025-05-16T12:10:20.181Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Packages","JavaScript","Repository","包","目录","Command-line apps","Uncategorized"],"sub_categories":["Command-line apps","NPM","命令行程序","命令行应用","Uncategorized"],"readme":"# npm-name\n\n\u003e Check whether a package or organization name is available on npm\n\n## Install\n\n```sh\nnpm install npm-name\n```\n\n## Usage\n\n```js\nimport npmName from 'npm-name';\n\n// Check a package name\nconsole.log(await npmName('chalk'));\n//=\u003e false\n\n// Check an organization name\nconsole.log(await npmName('@ava'));\n//=\u003e false\n\nconsole.log(await npmName('@abc123'));\n//=\u003e true\n\ntry {\n\tawait npmName('_ABC');\n} catch (error) {\n\tconsole.log(error.message);\n\t// Invalid package name: _ABC\n\t// - name cannot start with an underscore\n\t// - name can no longer contain capital letters\n}\n```\n\n## API\n\n### npmName(name, options?)\n\nCheck whether a package/organization name is available (not registered) on npm.\n\nAn organization name should start with `@` and should not be a scoped package.\n\nReturns a `Promise\u003cboolean\u003e` of whether the given name is available.\n\n#### name\n\nType: `string`\n\nThe name to check.\n\n#### options\n\nType: `object`\n\n##### registryUrl\n\nDefault: User's configured npm registry URL.\n\nTHe registry URL to check name availability against.\n\n**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.\n\n### npmNameMany(names, options?)\n\nCheck whether multiple package/organization names are available (not registered) on npm.\n\nReturns a `Promise\u003cMap\u003e` of name and status.\n\n```js\nimport {npmNameMany} from 'npm-name';\n\nconst result = await npmNameMany(['chalk', '@sindresorhus/is', 'abc123']);\n\nconsole.log(result.get('chalk'));\n//=\u003e false\n\nconsole.log(result.get('@sindresorhus/is'));\n//=\u003e false\n\nconsole.log(result.get('abc123'));\n//=\u003e true\n```\n\n#### names\n\nType: `string[]`\n\nMultiple names to check.\n\n#### options\n\nType: `object`\n\nSame as `npmName()`.\n\n## Related\n\n- [npm-name-cli](https://github.com/sindresorhus/npm-name-cli) - CLI for this module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fnpm-name","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fnpm-name","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fnpm-name/lists"}