added some checks for the where argument

This commit is contained in:
Andrew Mao
2013-07-30 18:34:35 -04:00
committed by David Glasser
parent 7d4cf4ae79
commit 940a8f3250

View File

@@ -1422,10 +1422,19 @@ _.extend(Package.prototype, {
return x;
return x ? [x] : [];
};
var places = ['client', 'server'];
var toWhereArray = function (where) {
if (where instanceof Array)
if (where instanceof Array) {
if (_.difference(where, places).length > 0)
buildmessage.error(where + " is not a valid argument.",
{ useMyCaller: true });
return where;
return where ? [where] : ['client', 'server'];
}
if (_.indexOf(places, where) === -1 )
buildmessage.error(where + " is not a valid argument.",
{ useMyCaller: true });
return where ? [where] : places;
};
var api = {