Skip to content

Commit

Permalink
chore(deps): refactor method to get deps
Browse files Browse the repository at this point in the history
  • Loading branch information
guzart committed Feb 3, 2015
1 parent e5786b7 commit fbc1e75
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});

Expand All @@ -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') {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit fbc1e75

Please # to comment.