Skip to content

Commit

Permalink
(fix) check for undefined and null options
Browse files Browse the repository at this point in the history
Before, genBase checked for truthy values which caused sending
false values to be ignored. Now, genBase checks for undefined and
null options. If they are not undefined and not null, then use
passed option. Otherwise, use value from .yo-rc.json.
  • Loading branch information
dustinspecker committed Aug 23, 2014
1 parent 2ee043b commit d3d5855
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions genBase/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@ Generator.prototype.getConfig = function getConfig() {
var config = {
markup: this.options.markup || this.config.get('markup'),
appScript: this.options['app-script'] || this.config.get('appScript'),
controllerAs: this.options['controller-as'] || this.config.get('controllerAs'),
passFunc: this.options['pass-func'] || this.config.get('passFunc'),
namedFunc: this.options['named-func'] || this.config.get('namedFunc'),
controllerAs: (this.options['controller-as'] !== undefined && this.options['controller-as'] !== null) ?
this.options['controller-as'] : this.config.get('controllerAs'),
passFunc: (this.options['pass-func'] !== undefined && this.options['pass-func'] !== null) ?
this.options['pass-func'] : this.config.get('passFunc'),
namedFunc: (this.options['named-func'] !== undefined && this.options['named-func'] !== null) ?
this.options['named-func'] : this.config.get('namedFunc'),
testScript: this.options['test-script'] || this.config.get('testScript'),
testDir: this.options['test-dir'] || this.config.get('testDir'),
style: this.options.style || this.config.get('style'),
ngRoute: this.options['ng-route'] || this.config.get('ngRoute'),
ngRoute: (this.options['ng-route'] !== undefined && this.options['ng-route'] !== null) ?
this.options['ng-route'] : this.config.get('ngRoute'),

appName: utils.getAppName(this.config.path),
ctrlName: utils.ctrlName(this.name),
Expand Down

0 comments on commit d3d5855

Please sign in to comment.