https://github.com/web-platform-tests/wpt
Revision 3b57b118a10cc6ec05c8d7aeb30ec6faadc729ad authored by Josh Matthews on 26 March 2018, 14:23:24 UTC, committed by Josh Matthews on 26 March 2018, 14:47:13 UTC
1 parent f4388a3
Raw File
Tip revision: 3b57b118a10cc6ec05c8d7aeb30ec6faadc729ad authored by Josh Matthews on 26 March 2018, 14:23:24 UTC
Add base protocol to ConnectionlessProtocol.
Tip revision: 3b57b11
arrays.js
// Returns true if the given arrays are equal. Optionally can pass an equality function.
export function areArraysEqual(a, b, equalityFunction = (c, d) => { return c === d; }) {
  try {
    if (a.length !== b.length)
      return false;

    for (let i = 0; i < a.length; i++) {
      if (!equalityFunction(a[i], b[i]))
        return false;
    }
  } catch (ex) {
    return false;
  }

  return true;
}
back to top