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
@types/validate-npm-package-name
TypeScript definitions for validate-npm-package-name
validate-npm-package-license
Give me a string and I'll tell you if it's a valid npm package license string
xml-name-validator
Validates whether a string matches the production for an XML name or qualified name
schema-utils
webpack Validation Utils
Is the given string an acceptable npm package name?
npm install validate-npm-package-name
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
299 Stars
112 Commits
45 Forks
27 Watching
2 Branches
81 Contributors
Updated on 15 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-1.3%
3,169,483
Compared to previous day
Last week
3.7%
16,843,420
Compared to previous week
Last month
14.3%
68,242,819
Compared to previous month
Last year
34.4%
694,300,686
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 dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
SAST tool detected but not run on all commits
Details
Reason
8 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 7
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-18
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