Skip to content

Commit

Permalink
feat(generators/*): ensure prompted-for data is ungrudgingly massaged…
Browse files Browse the repository at this point in the history
… to fit the expected representation patterns
  • Loading branch information
cueedee committed Mar 3, 2017
1 parent 2532218 commit 62b8343
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion generators/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var ApiGenerator = Generator.extend(
, validate: youtil.isIdentifier
, filter: function ( value )
{
return _.lowerFirst( _.trim( value ).replace( /api$/i, '' ));
return _.camelCase( _.lowerFirst( _.trim( value ).replace( /api$/i, '' )));
}
}
, {
Expand Down
8 changes: 6 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,15 @@ var AppGenerator = Generator.extend(
, name: 'packageName'
, message: 'What is the name of this app you so desire?'
, default:
(
_.kebabCase(
youtil.definedToString( this.options.packageName )
|| _.kebabCase( youtil.definedToString( this.appname ))
|| youtil.definedToString( this.appname )
)
, validate: youtil.isNpmName
, filter: function ( value )
{
return _.kebabCase( _.trim( value ));
}
}
, {
type: 'input'
Expand Down
2 changes: 1 addition & 1 deletion generators/collection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ var CollectionGenerator = Generator.extend(
, validate: youtil.isIdentifier
, filter: function ( value )
{
return _.lowerFirst( _.trim( value ).replace( /collection$/i, '' ));
return _.camelCase( _.lowerFirst( _.trim( value ).replace( /collection$/i, '' )));
}
}
, {
Expand Down
2 changes: 1 addition & 1 deletion generators/model/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var ModelGenerator = Generator.extend(
, validate: youtil.isIdentifier
, filter: function ( value )
{
return _.lowerFirst( _.trim( value ).replace( /model$/i, '' ));
return _.camelCase( _.lowerFirst( _.trim( value ).replace( /model$/i, '' )));
}
}
, {
Expand Down
2 changes: 1 addition & 1 deletion generators/view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var ViewGenerator = Generator.extend(
, validate: youtil.isIdentifier
, filter: function ( value )
{
return _.lowerFirst( _.trim( value ).replace( /view$/i, '' ));
return _.camelCase( _.lowerFirst( _.trim( value ).replace( /view$/i, '' )));
}
}
, {
Expand Down

0 comments on commit 62b8343

Please sign in to comment.