Skip to main content

@std/bytes@1.0.4
Built and signed on GitHub Actions

Utilities to manipulate Uint8Arrays that are not built-in to JavaScript

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 weeks ago (1.0.4)
function equals
equals(): boolean

Check whether byte slices are equal to each other.

Examples

Basic usage

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);

Parameters

First array to check equality.

Second array to check equality.

Return Type

true if the arrays are equal, false otherwise.

Add Package

deno add jsr:@std/bytes

Import symbol

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

---- OR ----

Import directly with a jsr specifier

import { equals } from "jsr:@std/bytes/equals";

Add Package

npx jsr add @std/bytes

Import symbol

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

Add Package

yarn dlx jsr add @std/bytes

Import symbol

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

Add Package

pnpm dlx jsr add @std/bytes

Import symbol

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

Add Package

bunx jsr add @std/bytes

Import symbol

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