Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

std/bytes/equals.ts>equals

The Deno Standard Library
Latest
function equals
import { equals } from "https://deno.land/std@0.224.0/bytes/equals.ts";

Check whether byte slices are equal to each other.

Examples

Basic usage

import { equals } from "https://deno.land/std@0.224.0/bytes/equals.ts";

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

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

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.