(function(e){vart={};varn=function(e){for(vart=0;t<e.length;t++){if(!(e[t]instanceofArray)){thrownewError("Every argument must be an array!")}}};t.distinct=function(t){if(arguments.length!=1)thrownewError("There must be exactly 1 array argument!");n(arguments);varr=[];for(vari=0;i<t.length;i++){vars=t[i];if(e.inArray(s,r)===-1){r.push(s)}}returnr};t.union=function(){if(arguments.length<2)thrownewError("There must be minimum 2 array arguments!");n(arguments);vart=this.distinct(arguments[0]);for(varr=1;r<arguments.length;r++){vari=arguments[r];for(vars=0;s<i.length;s++){varo=i[s];if(e.inArray(o,t)===-1){t.push(o)}}}returnt};t.intersect=function(){if(arguments.length<2)thrownewError("There must be minimum 2 array arguments!");n(arguments);vart=[];varr=this.distinct(arguments[0]);if(r.length===0)return[];for(vari=0;i<r.length;i++){vars=r[i];varo=true;for(varu=1;u<arguments.length;u++){vara=arguments[u];if(a.length==0)return[];if(e.inArray(s,a)===-1){o=false;break}}if(o){t.push(s)}}returnt};t.except=function(){if(arguments.length<2)thrownewError("There must be minimum 2 array arguments!");n(arguments);vart=[];varr=this.distinct(arguments[0]);vari=[];for(vars=1;s<arguments.length;s++){varo=arguments[s];i=i.concat(o)}for(vars=0;s<r.length;s++){varu=r[s];if(e.inArray(u,i)===-1){t.push(u)}}returnt};e.arrayUtilities=t;e.distinct=t.distinct;e.union=t.union;e.intersect=t.intersect;e.except=t.except})(jQuery)