From d3d585529cca48ed00c38fd27499e904f9bfeb9f Mon Sep 17 00:00:00 2001 From: Dustin Specker Date: Sat, 23 Aug 2014 17:41:18 -0500 Subject: [PATCH] (fix) check for undefined and null options 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. --- genBase/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/genBase/index.js b/genBase/index.js index 60493b2..d2c131c 100644 --- a/genBase/index.js +++ b/genBase/index.js @@ -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),