React Hookers - v6.3.0
    Preparing search index...

    Class BigArray<T>

    A mutable array that can store up to 2⁵⁴ - 2 elements.

    Indices must be in the range [NumberConstructor.MIN_SAFE_INTEGER, NumberConstructor.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

      The type of values stored in the array.

    Index

    Constructors

    Properties

    endIndex: number = 0

    The index of the last element in the array (exclusive).

    negativeCount: number = 0

    The total number of negative indices in the array.

    positiveCount: number = 0

    The total number of non-negative indices in the array.

    startIndex: number = 0

    The index of the first element in the array (inclusive).

    Methods

    • Returns an iterator over existing values.

      Returns IterableIterator<T>

    • Copies up to length elements from source (starting at sourceStartIndex) into this array (starting at startIndex).

      Parameters

      • source: Iterable<T, any, any> | ArrayLike<T>

        The source of elements.

      • startIndex: number = 0

        The index in this array to start writing at.

      • sourceStartIndex: number = 0

        The index in the source to start reading at.

      • length: number = Infinity

        The maximum number of elements to read from the source.

      Returns this

    • Returns the element stored at index, or undefined if no element exists at that index.

      Parameters

      • index: number

        An integer element index.

      Returns T

    • Returns the element stored at index, or uses lazyValue to produce and store an element.

      Parameters

      • index: number

        An integer element index.

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

        A value or a callback that returns a value for the given index.

      Returns T

      The value stored at index.

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

      Parameters

      • index: number

        An integer element index.

      Returns boolean

    • Returns an iterator over indices of existing elements (as determined by has).

      Returns IterableIterator<number>

    • Appends an element to the array at endIndex.

      Parameters

      • value: T

        The value to append.

      Returns this

    • Sets the element at index.

      Parameters

      • index: number

        An integer element index.

      • value: T

        The value to store.

      Returns this

    • Returns a slice of elements from this array. The slice length will not exceed 2³² items.

      Parameters

      • startIndex: number = ...

        The start index of the slice (inclusive).

      • endIndex: number = ...

        The end index of the slice (exclusive).

      Returns T[]

    • Prepends an element to the array before startIndex.

      Parameters

      • value: T

        The value to prepend.

      Returns this

    • Returns an iterator over existing values.

      Returns IterableIterator<T>