package name / version validation

This commit is contained in:
Grahame Grieve 2019-11-20 20:44:33 +11:00
parent d98c496712
commit f9c8b65083
1 changed files with 8 additions and 0 deletions

View File

@ -616,6 +616,14 @@ public class NpmPackage {
return urls;
}
public static boolean isValidName(String pid) {
return pid.matches("^[a-z][a-zA-Z0-9]*(\\.[a-z][a-zA-Z0-9]*)+$");
}
public static boolean isValidVersion(String ver) {
return ver.matches("^[0-9]+\\.[0-9]+\\.[0-9]+$");
}
}