Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/bytes/index.ts>includesSlice

A JavaScript extension package for building strong and modern applications.
Latest
function includesSlice
import { includesSlice } from "https://deno.land/x/ayonli_jsext@v0.9.72/bytes/index.ts";

Checks if the byte array contains another array as a slice of its contents.

Examples

Example 1

import { includesSlice } from "@ayonli/jsext/bytes";

const arr = new Uint8Array([1, 2, 3, 4, 5]);

console.log(includesSlice(arr, new Uint8Array([3, 4]))); // true
console.log(includesSlice(arr, new Uint8Array([4, 3]))); // false

Parameters

arr: Uint8Array
slice: Uint8Array

Returns

boolean