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

x/easyts/container/types.ts>Container

js library written with ts, use select and chan like golang in js.
Latest
interface Container
implements Comparable<T>, Iterable<T>
import { type Container } from "https://deno.land/x/easyts@0.1.3/container/types.ts";

container interface

Properties

readonly
length: number

Returns the current amount of data in the container

readonly
capacity: number

Returns the current capacity of the container

readonly
isEmpty: boolean

Returns true if there is no data in the container

readonly
isNotEmpty: boolean

Returns true if there is data in the container

readonly
isFull: boolean

Returns true if the container has reached the container limit

readonly
isNotFull: boolean

Returns true if the container has not reached the container limit

Methods

clone(callback?: CloneCallback<T>): Container<T>

Create a full copy of the container

clear(callback?: DeleteCallback<T>): void

Empty the data in the container

compareTo(o: Container<T>, callback?: CompareCallback<T>): number

Returns true if the data depth of the two containers is consistent

iterator(reverse?: boolean): Iterator<T>

Returns a js iterator

getter
reverse(): Iterable<T>

Returns an object that implements a js Iterable, but it traverses the data in reverse

forEach(callback: ValueCallback<T>, reverse?: boolean): void

call callback on each element in the container in turn

find(callback: ValidCallback<T>, reverse?: boolean): boolean

Traverse the container looking for elements until the callback returns true, then stop looking

map<TO>(callback: MapCallback<T, TO>, reverse?: boolean): Array<TO>

Convert container to array

has(
data: T,
reverse?: boolean,
callback?: CompareCallback<T>,
): boolean

Returns whether the data data exists in the container

join(separator?: string | undefined): string

Adds all the elements of an container into a string, separated by the specified separator string.