Gathering detailed insights and metrics for validate-npm-package-name
Gathering detailed insights and metrics for validate-npm-package-name
Gathering detailed insights and metrics for validate-npm-package-name
Gathering detailed insights and metrics for validate-npm-package-name
is-scoped
Check if a string is a scoped npm package name
@types/validate-npm-package-name
TypeScript definitions for validate-npm-package-name
package-name-regex
Provides a regex that can be used to test if a string is a valid NPM package name.
inquirer-npm-name
Helper function using inquirer to validate a value provided in a prompt does not exist as an npm package.
Is the given string an acceptable npm package name?
npm install validate-npm-package-name
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.8
Supply Chain
100
Quality
82.9
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
2,391,769,361
Last Day
3,564,453
Last Week
18,843,513
Last Month
76,958,877
Last Year
787,002,921
ISC License
301 Stars
113 Commits
46 Forks
26 Watchers
1 Branches
78 Contributors
Updated on May 04, 2025
Minified
Minified + Gzipped
Latest Version
6.0.0
Package Id
validate-npm-package-name@6.0.0
Unpacked Size
7.61 kB
Size
3.12 kB
File Count
4
NPM Version
10.8.3
Node Version
22.9.0
Published on
Sep 25, 2024
Cumulative downloads
Total Downloads
Last Day
1.1%
3,564,453
Compared to previous day
Last Week
11.7%
18,843,513
Compared to previous week
Last Month
1.8%
76,958,877
Compared to previous month
Last Year
33.1%
787,002,921
Compared to previous year
3
Give me a string and I'll tell you if it's a valid npm
package name.
This package exports a single synchronous function that takes a string
as
input and returns an object with two properties:
validForNewPackages
:: Boolean
validForOldPackages
:: Boolean
Below is a list of rules that valid npm
package name should conform to.
.
or _
~)('!*
1var validate = require("validate-npm-package-name") 2 3validate("some-package") 4validate("example.com") 5validate("under_score") 6validate("123numeric") 7validate("@npm/thingy") 8validate("@jane/foo.js")
All of the above names are valid, so you'll get this object back:
1{ 2 validForNewPackages: true, 3 validForOldPackages: true 4}
1validate("excited!") 2validate(" leading-space:and:weirdchars")
That was never a valid package name, so you get this:
1{ 2 validForNewPackages: false, 3 validForOldPackages: false, 4 errors: [ 5 'name cannot contain leading or trailing spaces', 6 'name can only contain URL-friendly characters' 7 ] 8}
In the old days of npm, package names were wild. They could have capital letters in them. They could be really long. They could be the name of an existing module in node core.
If you give this function a package name that used to be valid, you'll see
a change in the value of validForNewPackages
property, and a warnings array
will be present:
1validate("eLaBorAtE-paCkAgE-with-mixed-case-and-more-than-214-characters-----------------------------------------------------------------------------------------------------------------------------------------------------------")
returns:
1{ 2 validForNewPackages: false, 3 validForOldPackages: true, 4 warnings: [ 5 "name can no longer contain capital letters", 6 "name can no longer contain more than 214 characters" 7 ] 8}
1npm install 2npm test
ISC
No vulnerabilities found.
Reason
all changesets reviewed
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
SAST tool detected but not run on all commits
Details
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More