Socket
Socket
Sign inDemoInstall

validate-npm-package-name

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-npm-package-name - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

12

index.js

@@ -1,2 +0,6 @@

var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$")
var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
var blacklist = [
"node_modules",
"favicon.ico"
];

@@ -52,2 +56,8 @@ var validate = module.exports = function(name, options) {

blacklist.forEach(function(blacklistedName){
if (name.toLowerCase() === blacklistedName) {
errors.push(blacklistedName + " is a blacklisted name")
}
})
if (encodeURIComponent(name) !== name) {

@@ -54,0 +64,0 @@

2

package.json
{
"name": "validate-npm-package-name",
"version": "1.1.1",
"version": "1.2.0",
"description": "Give me a string and I'll tell you if it's a valid npm package name",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -52,2 +52,10 @@ var valid = require("..")

t.deepEqual(valid("node_modules"), {
valid: false,
errors: ["node_modules is a blacklisted name"]})
t.deepEqual(valid("favicon.ico"), {
valid: false,
errors: ["favicon.ico is a blacklisted name"]})
// Legacy Mixed-Case

@@ -54,0 +62,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc