Function equals

  • Check whether byte slices are equal to each other.

    Parameters

    • a: Uint8Array

      First array to check equality.

    • b: Uint8Array

      Second array to check equality.

    Returns boolean

    true if the arrays are equal, false otherwise.

    import { equals } from "@std/bytes/equals";
    import { assertEquals } from "@std/assert";

    const a = new Uint8Array([1, 2, 3]);
    const b = new Uint8Array([1, 2, 3]);
    const c = new Uint8Array([4, 5, 6]);

    assertEquals(equals(a, b), true);
    assertEquals(equals(a, c), false);