Class BigArray<T>

A mutable array that can store up to 2 ^ 54 - 2 elements.

Indices should be in range [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER].

const array = new BigArray<string>();

array.push('hello');

for (let i = array.startIndex; i < array.endIndex; ++i) {
const value = array.get(i);
}

Type Parameters

  • T

    A value stored in an array.

Constructors

Properties

endIndex: number = 0

An index of the last element in an array, exclusive.

startIndex: number = 0

An index of the first element in an array, inclusive.

Methods

  • Returns an element stored at an index or undefined.

    Parameters

    • index: number

      An integer index of an element.

    Returns undefined | T

  • Returns an element stored at an index or uses lazyValue to produce an element.

    Parameters

    • index: number

      An integer index of an element.

    • lazyValue: T | ((index: number) => T)

      A value or a callback that returns a value for an index.

    Returns T

    A value stored at an index.

  • Returns true if an array contains an element with the index.

    Parameters

    • index: number

      An integer index of an element.

    Returns boolean

  • Returns a new iterator object that contains indexes of existing elements.

    Returns IterableIterator<number, any, any>

  • Appends an element to an array after the endIndex.

    Parameters

    • value: T

      A value to append.

    Returns void

  • Sets an element at an index.

    Parameters

    • index: number

      An integer index of an element.

    • value: T

      A value to set.

    Returns void

  • Prepends an element to an array before the startIndex.

    Parameters

    • value: T

      A value to prepend.

    Returns void