Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (name.trim() !== name) {
errors.push("name cannot contain leading or trailing spaces")
}
// No funny business
blacklist.forEach(function(blacklistedName){
if (name.toLowerCase() === blacklistedName) {
errors.push(blacklistedName + " is a blacklisted name")
}
})
// Generate warnings for stuff that used to be allowed
// core module names like http, events, util, etc
builtins.forEach(function(builtin){
if (name.toLowerCase() === builtin) {
warnings.push(builtin + " is a core module name")
}
})
// really-long-package-names-------------------------------such--length-----many---wow
// the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch.
if (name.length > 214) {
warnings.push("name can no longer contain more than 214 characters")
}
// mIxeD CaSe nAMEs
if (name.toLowerCase() !== name) {
warnings.push("name can no longer contain capital letters")
}
if (name.trim() !== name) {
errors.push("name cannot contain leading or trailing spaces")
}
// No funny business
blacklist.forEach(function(blacklistedName){
if (name.toLowerCase() === blacklistedName) {
errors.push(blacklistedName + " is a blacklisted name")
}
})
// Generate warnings for stuff that used to be allowed
// core module names like http, events, util, etc
builtins.forEach(function(builtin){
if (name.toLowerCase() === builtin) {
warnings.push(builtin + " is a core module name")
}
})
// really-long-package-names-------------------------------such--length-----many---wow
// the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch.
if (name.length > 214) {
warnings.push("name can no longer contain more than 214 characters")
}
// mIxeD CaSe nAMEs
if (name.toLowerCase() !== name) {
warnings.push("name can no longer contain capital letters")
}
if (name.trim() !== name) {
errors.push('name cannot contain leading or trailing spaces')
}
// No funny business
blacklist.forEach(function (blacklistedName) {
if (name.toLowerCase() === blacklistedName) {
errors.push(blacklistedName + ' is a blacklisted name')
}
})
// Generate warnings for stuff that used to be allowed
// core module names like http, events, util, etc
builtins.forEach(function (builtin) {
if (name.toLowerCase() === builtin) {
warnings.push(builtin + ' is a core module name')
}
})
// really-long-package-names-------------------------------such--length-----many---wow
// the thisisareallyreallylongpackagenameitshouldpublishdowenowhavealimittothelengthofpackagenames-poch.
if (name.length > 214) {
warnings.push('name can no longer contain more than 214 characters')
}
// mIxeD CaSe nAMEs
if (name.toLowerCase() !== name) {
warnings.push('name can no longer contain capital letters')
}