diff --git a/core/misc/states.js b/core/misc/states.js index 75ee01d..ea4f061 100644 --- a/core/misc/states.js +++ b/core/misc/states.js @@ -75,6 +75,23 @@ states.Dependent.comparisons = { // The "reference" variable is a comparison function. return reference(value); }, + 'Array': function (reference, value) { + // Make sure value is an array. + if (!(typeof(value) == 'object' && (value instanceof Array))) { + return false; + } + // We iterate through each value provided in the reference. If all of them + // exist in value array, we return true. Otherwise return false. + var arrayComplies = true; + $.each(reference, function(key, val) { + if ($.inArray(val, value) < 0) { + arrayComplies = false; + // Break the loop. + return false; + } + }); + return arrayComplies; + }, 'Number': function (reference, value) { // If "reference" is a number and "value" is a string, then cast reference // as a string before applying the strict comparison in compare(). Otherwise