Utility function that checks if the content of an array
is a subset of the content of a second (reference) array
176444
function isSubSet (aTestArray, aRefArray) {
		function isOutsideSet(sTestValue) {
			return aRefArray.indexOf(sTestValue) < 0; // value is not part of the reference set
		}
		return aTestArray && aRefArray && !aTestArray.some(isOutsideSet);
	}
865277
function arrayIndexOfComparer(array, item, comparer) {
    for (var i = 0, len = array.length; i < len; i++) {
      if (comparer(array[i], item)) { return i; }
    }
    return -1;
  }
596054
function smartIndexOf(array, test) {
    var index = -1;
    if (!array || !test) return index;
    var length = array.length;
    if (!length) return index;
    while (++index < length) {
        if (test(array[index], index, array)) return index;
    }
    return -1;
}
962281
function isArrayLike (a) {
  if ('object' != typeof a)
    return false
  else if (null == a)
    return false
  else
    return Boolean( Array.isArray(a)
                    || null != a.length
                    || a[0] )
}
1007306
function (array1, array2) {
                return array1.every(function (element) {
                    return array2.includes(element);
                }) && array1.length === array2.length;
            }
934709
function isSubsetOf(subset, superset, cmp, contains, ordered) {
    if (!contains) {
      if (subset.length !== superset.length) return false;
      superset = superset.slice();
    }

    return subset.every(function(elem, idx) {
      if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx];

      if (!cmp) {
        var matchIdx = superset.indexOf(elem);
        if (matchIdx === -1) return false;

        // Remove match from superset so not counted twice if duplicate in subset.
        if (!contains) superset.splice(matchIdx, 1);
        return true;
      }

      return superset.some(function(elem2, matchIdx) {
        if (!cmp(elem, elem2)) return false;

        // Remove match from superset so not counted twice if duplicate in subset.
        if (!contains) superset.splice(matchIdx, 1);
        return true;
      });
    });
  }
1331344
function ( array1, array2 ) {
		var a = array1.length > array2.length ? array1 : array2,
		    b = ( a === array1 ? array2 : array1 );

		return a.filter( function ( key ) {
			return array.contains( b, key );
		});
	}
242725
function(a, b) {
                var as = a.specificity;
                var bs = b.specificity;

                if (as[0] != bs[0]) return bs[0] - as[0];
                if (as[1] != bs[1]) return bs[1] - as[1];
                if (as[2] != bs[2]) return bs[2] - as[2];
                return bs[3] - as[3];
            }
1345663
function compare(a, b) {
    if (Type.isString(a)) {
        return a === b;
    } else if (Type.isNumber(a)) {
        if (isNaN(a) || isNaN(b)) {
            return isNaN(a) === isNaN(b);
        }
        return a === b;
    } else if (Type.isBoolean(a)) {
        return a === b;
    } else if (Type.isDate(a) && Type.isDate(b)) {
        return a.getTime() === b.getTime();
    } else if (Type.isRegExp(a) && Type.isRegExp(b)) {
        return a.source === b.source;
    } else if (Type.isArray(a) && Type.isArray(b)) {
        // check references first
        if (a === b) {
            return true;
        }
        return a.every(function (item, index) {
            try {
                return compare(item, b[index]);
            } catch (e) {
                throw e;
            }
        });
    } else if (Type.isObject(a) && Type.isObject(b)) {
        var equal = [];
        // check references first
        if (a === b) {
            return true;
        }

        try {
            for (var key in a) {
                equal.push(compare(a[key], b[key]));
            }
        } catch (e) {
            throw e;
        }
        return equal.every(function (item) {
            return item === true;
        });
        /// compare undefined and nulls and nans
    } else if (a === b) {
        return true;
    }

    return false;
}
720168
function contains(array, exp) {

  if(!isArray(array) || isUndefined(exp)) {
    return true;
  }

  return array.some(function(elm) {
    return (isObject(elm) || isFunction(exp))
      ? $parse(exp)(elm)
      : elm === exp;
  });
}
1342881
function ( array1, array2 ) {
		var result = [];

		array.each( array1, function ( i ) {
			if ( !array.contains( array2, i ) ) {
				array.add( result, i );
			}
		});

		array.each( array2, function ( i ) {
			if ( !array.contains( array1, i ) ) {
				array.add( result, i );
			}
		});

		return result;
	}
1070030
function(array1, array2) {
            // make sure these are actually arrays
            if(!(array1 instanceof Array) || !(array2 instanceof Array)) {
                return false;
            }
            if(array1 === array2) {
                // true if they are the same object
                return true;
            }
            if(array1.length !== array2.length) {
                // false if they are different lengths
                return false;
            }
            // false if any of their elements don't match
            for(var i = 0; i < array1.length; i++) {
                if(array1[i] !== array2[i]) {
                    return false;
                }
            }
            return true;
        }
1083189
def is_subset(a, b):
    """"""
    return b.left <= a.left and b.right > a.right or b.left < a.left and b.right >= a.right
1336221
function Array_includes(searchElement, // @arg Any
                        position) {    // @arg Integer = 0
                                       // @ret Boolean
    position = position || 0;
    var iz = this.length;

    if (iz === 0) {
        return false;
    }

    var i = 0;

    if (position >= 0) {
        i = position;
    } else {
        i = position + iz;
        if (i < 0) {
            i = 0;
        }
    }

    if (searchElement === searchElement) {
        for (; i < iz; ++i) {
            if (this[i] === searchElement) {
                return true;
            }
        }
    } else if (isNaN(searchElement)) {
        for (; i < iz; ++i) {
            if (isNaN(this[i])) {
                return true;
            }
        }
    } else { // maybe Symble, ... etc
        throw TypeError("Unsupported type");
    }
    return false;
}
217635
function isArrayOfArray(o) {
    if(isArray(o)) {
      if(o.length > 0) {
        if(isArray(o[0])) {
          return true;
        }
      }
    }
    return false;
  }
747764
private static boolean nonEmptyIntersection(String[] a, String[] b) {
    if (a == null || b == null || a.length == 0 || b.length == 0) {
      return false;
    }
    for (String toFind : a) {
      if (contains(b, toFind)) {
        return true;
      }
    }
    return false;
  }
1240563
function arraysEqual(first, second){
    if(!Array.isArray(first)) throw new Error("first must be an array.");    
    if(!Array.isArray(second)) throw new Error("second must be an array.");
    if(first.length !== second.length) return false;
    for (var i = 0; i < first.length; i++) {
        if(first[i] !== second[i]) return false;
    }
    return true;
}