| 366 | //} |
| 367 | |
| 368 | function __arrayEquals(a1, a2, equalsFn) { |
| 369 | //Check if the arrays are undefined/null |
| 370 | if (!a1 || !a2) return false; |
| 371 | |
| 372 | if (a1.length !== a2.length) return false; |
| 373 | |
| 374 | //go thru all the vars |
| 375 | for (var i = 0; i < a1.length; i++) { |
| 376 | //if the var is an array, we need to make a recursive check |
| 377 | //otherwise we'll just compare the values |
| 378 | if (Array.isArray(a1[i])) { |
| 379 | if (!__arrayEquals(a1[i], a2[i])) return false; |
| 380 | } else { |
| 381 | if (equalsFn) { |
| 382 | if (!equalsFn(a1[i], a2[i])) return false; |
| 383 | } else { |
| 384 | if (a1[i] !== a2[i]) return false; |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | return true; |
| 389 | } |
| 390 | |
| 391 | // end of array functions |
| 392 | |