Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
Use regex to validate packageName
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Buck committed Oct 27, 2014
1 parent ee0195d commit 3b05754
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/index.js
Expand Up @@ -44,10 +44,8 @@ var GulpIonicGenerator = yeoman.generators.Base.extend({
name: 'appId',
message: 'state the id of your project (e.g. com.company.project)',
validate: function (value) {
var splits = value.split('.').filter(function (element) {
return element.length;
});
return splits.length >= 3 ? true : 'Please enter a valid id! E.g. com.company.project';
var pattern = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/i;
return pattern.test(value) ? true : 'Please enter a valid id! E.g. com.company.project';
}
},
// bower packages
Expand Down

0 comments on commit 3b05754

Please sign in to comment.