code: function __arrayEquals(a1, a2, equalsFn) {
    //Check if the arrays are undefined/null
    if (!a1 || !a2) return false;
  
    if (a1.length !== a2.length) return false;
  
    //go thru all the vars
    for (var i = 0; i < a1.length; i++) {
      //if the var is an array, we need to make a recursive check
      //otherwise we'll just compare the values
      if (Array.isArray(a1[i])) {
        if (!__arrayEquals(a1[i], a2[i])) return false;
      } else {
        if (equalsFn) {
          if (!equalsFn(a1[i], a2[i])) return false;
        } else {
          if (a1[i] !== a2[i]) return false;
        }
      }
    }
    return true;
  }
docs: Not yet needed // much faster but only works on array items with a toString method that // returns distinct string for distinct objects.  So this is safe for arrays with primitive // types but not for arrays with object types, unless toString() has been implemented. function arrayDistinctUnsafe(array) { var o = {}, i, l = array.length, r = []; for (i = 0; i < l; i += 1) { var v = array[i]; o[v] = v; } for (i in o) r.push(o[i]); return r; }