Skip to main content
Version: v1

List Class

Signature

export declare class List<T>

Type Parameters

Parameter Description
T

Constructors

Constructor Description
(constructor)(isHead, data) Constructs a new instance of the List class

Properties

Property Type Description
data T | undefined
isHead boolean
next List<T>
prev List<T>

Methods

Method Alerts Return Type Description
[Symbol.iterator]() IterableIterator<T>
clear() void
count() number
dequeue() T | undefined
empty() boolean
enqueue(data) List<T>
first() T | undefined
last() T | undefined
push(data) Deprecated void
some(fn, rev) T[]
unshift(data) void
walk(fn) void

Constructor Details

(constructor)

Constructs a new instance of the List class

Signature

constructor(isHead: boolean, data: T | undefined);

Parameters

Parameter Type Description
isHead boolean
data T | undefined

Property Details

data

Signature

data: T | undefined;

Type: T | undefined

isHead

Signature

isHead: boolean;

Type: boolean

next

Signature

next: List<T>;

Type: List<T>

prev

Signature

prev: List<T>;

Type: List<T>

Method Details

[Symbol.iterator]

Signature

[Symbol.iterator](): IterableIterator<T>;

Returns

Return type: IterableIterator<T>

clear

Signature

clear(): void;

count

Signature

count(): number;

Returns

Return type: number

dequeue

Signature

dequeue(): T | undefined;

Returns

Return type: T | undefined

empty

Signature

empty(): boolean;

Returns

Return type: boolean

enqueue

Signature

enqueue(data: T): List<T>;

Parameters

Parameter Type Description
data T

Returns

Return type: List<T>

first

Signature

first(): T | undefined;

Returns

Return type: T | undefined

last

Signature

last(): T | undefined;

Returns

Return type: T | undefined

push

This API is deprecated and will be removed in a future release.
  • use unshift

Signature

push(data: T): void;

Parameters

Parameter Type Description
data T

some

Signature

some(fn: (data: T, l: List<T>) => boolean, rev?: boolean): T[];

Parameters

Parameter Modifiers Type Description
fn (data: T, l: List<T>) => boolean
rev optional boolean

Returns

Return type: T[]

unshift

Signature

unshift(data: T): void;

Parameters

Parameter Type Description
data T

walk

Signature

walk(fn: (data: T, l: List<T>) => void): void;

Parameters

Parameter Type Description
fn (data: T, l: List<T>) => void