Skip to content

Commit

Permalink
fix(env) allow the use of $type without $aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
jcare44 authored and Julien Caré committed Nov 5, 2015
1 parent 452c1d5 commit 855221f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ module.exports = function envFactory() {
}

function getOrElseAliases(fullKeyName, object) {
if (object.$type && _.isUndefined(object.$aliases)) {
object.$aliases = [];
}
if (!Array.isArray(object.$aliases)) {
throw new Error('Common-env: $aliases must be defined along side $default, key: ' + fullKeyName);
}
Expand Down Expand Up @@ -154,7 +157,7 @@ function isArrayOfAtom(array) {
}

function isAliasesObject(value) {
return _.isPlainObject(value) && (_.has(value, '$default') || _.has(value, '$aliases'));
return _.isPlainObject(value) && (_.has(value, '$default') || _.has(value, '$aliases') || _.has(value, '$type'));
}

/**
Expand Down

0 comments on commit 855221f

Please sign in to comment.