read-package-json
Advanced tools
Comparing version 0.1.13 to 0.2.0
{ | ||
"name": "read-package-json", | ||
"version": "0.1.13", | ||
"version": "0.2.0", | ||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", | ||
@@ -5,0 +5,0 @@ "description": "The thing npm uses to read package.json files with semantics and defaults and validation", |
@@ -557,10 +557,15 @@ // vim: set softtabstop=16 shiftwidth=16: | ||
function validName (file, data) { | ||
if (!data.name) return new Error("No 'name' field") | ||
if (!data.name) { | ||
data.name = "" | ||
return true | ||
} | ||
data.name = data.name.trim() | ||
if (data.name.charAt(0) === "." || | ||
data.name.match(/[\/@\s\+%:]/) || | ||
data.name !== encodeURIComponent(data.name) || | ||
data.name.toLowerCase() === "node_modules" || | ||
data.name.toLowerCase() === "favicon.ico") { | ||
return new Error("Invalid name: " + | ||
JSON.stringify(data.name)) | ||
var m = "Invalid name: " | ||
m += JSON.stringify(data.name) | ||
return new Error(m) | ||
} | ||
@@ -581,3 +586,6 @@ return true | ||
var v = data.version | ||
if (!v) return new Error("no version"); | ||
if (!v) { | ||
data.version = "" | ||
return true | ||
} | ||
if (!semver.valid(v)) { | ||
@@ -584,0 +592,0 @@ return new Error("invalid version: "+v) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35888
742