Class: SealedArray

SealedArray(…args)

A class for those pedantic people who can't stand dynamic memory allocation. This class gives you a fixed length array. Every method that would in the case of a normal array push items off the other end.

Constructor

new SealedArray(…args)

Constructs a new SealedArray. Argument format is the same as that of Array.

Parameters:
Name Type Attributes Description
args * <repeatable>

The arguments to pass to Array.

Source:

Extends

  • Array

Methods

clone() → {SealedArray}

Returns a shallow duplicate of the array.

Source:
Returns:

The shallow clone.

Type
SealedArray

filter(fn) → {SealedArray}

The SealedArray equivalent of Array.prototype.filter.

Parameters:
Name Type Description
fn ArrayCallback

The callback to iterate on.

Source:
Returns:

The filtered array

Type
SealedArray

map(fn) → {SealedArray}

The SealedArray equivalent of Array.prototype.map.

Parameters:
Name Type Description
fn ArrayCallback

The function to map the array with.

Source:
Returns:

The mapped array.

Type
SealedArray

pop() → {*}

Removes the last item at the end of the array, and puts undefined onto the beginning.

Source:
Returns:

The item that was at the end of the array.

Type
*

push(…args) → {number}

Pushes item(s) to the end of the array. Items that overflow the beginning are removed from the array.

Parameters:
Name Type Attributes Description
args * <repeatable>

The items to push to the end of the array.

Source:
Returns:

The length of the array.

Type
number

shift() → {*}

Removes the first item in the array, and pushes undefined onto the end.

Source:
Returns:

The item that was at the start of the array.

Type
*

unshift(…args) → {number}

Pushes items to the beginning of the array. Items that overflow the end are removed.

Parameters:
Name Type Attributes Description
args * <repeatable>

The items to prepend at the start of the array.

Source:
Returns:

The length of the array.

Type
number

Type Definitions

ArrayCallback(item, index, array) → {*}

Parameters:
Name Type Description
item *

The item.

index number

The index of the item in the array.

array Array

The array being mapped.

Source:
Returns:

The result.

Type
*