Documentation ¶
Index ¶
Constants ¶
View Source
const ( WarnBuiltin = iota WarnTooLong WarnMixCase WarnSpecialChars )
Variables ¶
View Source
var ( ErroEmpty = errors.New("name lenght must be greater than zero") ErroDot = errors.New("name cannot start with a dot") Erro_ = errors.New("name cannot start with an underscore") ErroNonURLFriendly = errors.New("name can only contain URL friendly characters") ErroBlacklist = errors.New("name is in blacklist") ErroTrim = errors.New("name cannot containg leading or trailing spaces") )
Define sentinel errors
Functions ¶
This section is empty.
Types ¶
type Warning ¶
type Warning int
func Validate ¶
Validate validates the input npm package name.
Notice that npm newer versions follow stricter naming rules. For an input package name to be valid for newer npm rules, this function must give no error AND no warnings (empty slice).
When this function returns an error, the input package name is invalid even for previous npm naming rules.
In case this function returns warnings only, then the input package name is only valid for the previous npm naming rules.
Click to show internal directories.
Click to hide internal directories.