diff --git a/core/misc/states.js b/core/misc/states.js index 5c39775..55943ea 100644 --- a/core/misc/states.js +++ b/core/misc/states.js @@ -76,20 +76,18 @@ states.Dependent.comparisons = { return reference(value); }, 'Array': function (reference, value) { - //Make sure that value is an array, other wise we end up always evaling to true + // Make sure value is an array. if (!(typeof(value) == 'object' && (value instanceof Array))) { return false; } - //We iterate through each of the values provided in the reference - //and check that they all exist in the value array. - //If even one doesn't then we return false. Otherwise return true. - var arrayComplies = true; + // We iterate through each value provided in the reference. If all of them + // exist in value array, we return true. Otherwise return false. $.each(reference, function(key, val) { if ($.inArray(val, value) < 0) { - arrayComplies = false; + return false; } }); - return arrayComplies; + return true; }, 'Number': function (reference, value) { // If "reference" is a number and "value" is a string, then cast reference