diff --git a/index.js b/index.js index 388779a..1b20f7b 100644 --- a/index.js +++ b/index.js @@ -44,7 +44,7 @@ function ngConstantPlugin(opts) { // Create the module string var result = _.template(template, { moduleName: options.name || data.name, - deps: isDepsFalse(options, data) ? false : options.deps || data.deps || [], + deps: getModuleDeps(data, options), constants: getConstants(data, options) }); @@ -64,6 +64,14 @@ function ngConstantPlugin(opts) { } } +function getModuleDeps(data, options) { + if (options.deps === false || data.deps === false) { + return false; + } + + return options.deps || data.deps || []; +} + function getConstants(data, options) { var opts = options || {}; if (typeof opts.constants === 'string') { @@ -117,14 +125,6 @@ function stringify(value, space) { return _.isUndefined(value) ? 'undefined' : JSON.stringify(value, null, space); } -function isDepsFalse(options, data) { - if (options.deps === false || (!options.deps && data.deps === false)) { - return true; - } else { - return false; - } -} - _.extend(ngConstantPlugin, { getConstants: getConstants, getFilePath: getFilePath,