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
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
303 Stars
118 Commits
48 Forks
25 Watchers
1 Branches
81 Contributors
Updated on Jul 09, 2025
Latest Version
6.0.1
Package Id
validate-npm-package-name@6.0.1
Unpacked Size
7.71 kB
Size
3.15 kB
File Count
4
NPM Version
11.4.1
Node Version
22.16.0
Published on
Jun 05, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
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
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
SAST tool detected but not run on all commits
Details
Reason
5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-07
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