Skip to main content
Module

x/typeddeque/mod.ts>Uint8Deque

Variable length TypedArray
Latest
class Uint8Deque
import { Uint8Deque } from "https://deno.land/x/typeddeque@v0.3.0/mod.ts";

A variable length array of 8-bit unsigned integers.

Constructors

new
Uint8Deque(array?: Uint8Array)

Properties

readonly
byteLength

Returns the length (in bytes) of the Uint8Deque.

readonly
length

Returns the number of elements held in the Uint8Deque.

Methods

private
_chunkAt(i: number): [number, number]
at(index: number): number | undefined

Returns the element at the given index. Returns undefined if the given index can not be found.

clear(): void

Removes all elements from the Uint8Deque.

forEach(callbackFn: (
value: number,
index: number,
deque: Uint8Deque,
) => void
): void
includes(searchElement: number, fromIndex?): boolean

Determines whether a Uint8Deque includes a certain element.

indexOf(searchElement: number, fromIndex?): number

Returns the first index at which a given element can be found in the Uint8Deque, or -1 if it is not present.

pop(count?): void

Removes up to the given number of elements from the end of the Uint8Deque.

push(array: Uint8Array): number

Appends the given array to the end of the Uint8Deque, and returns the new length of the Uint8Deque. This will not create a new buffer, changes to the given array will impact the Uint8Deque and vice versa.

set(array: number[] | Uint8Array, offset?): void

Copy the content of an array into the Uint8Deque.

shift(count?): void

Removes up to the given number of elements from the start of the Uint8Deque.

slice(start?, end?): Uint8Array

Returns a new typed array that contains a copy of a portion of the Uint8Deque from start up to but not including end. A negative index can be used, indicating an offset from the end. An empty array is returned if start >= end.

toString(): string

Static Properties

readonly
BYTES_PER_ELEMENT

Returns a number value of the element size. 1 in the case of an Uint8Deque.