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

Commit

Permalink
Merge pull request #57 from mwaylabs/packagename-regex
Browse files Browse the repository at this point in the history
Use regex to validate packageName
  • Loading branch information
stefanbuck committed Oct 28, 2014
2 parents e04c9fe + 3b05754 commit 20dc5ce
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,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 20dc5ce

Please sign in to comment.