Class Slice<T>

Type Parameters

  • T

Hierarchy

  • ClassForEach<T>
    • Slice

Implements

  • Iterable<T>

Constructors

  • Type Parameters

    • T

    Parameters

    • array: T[]
    • start: number
    • end: number

    Returns Slice<T>

Properties

array: T[]
end: number
start: number

Accessors

  • get capacity(): number
  • return slice capacity

    Returns number

  • get length(): number
  • return slice length

    Returns number

  • get reverse(): Iterable<T>
  • Sealed

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

    Returns Iterable<T>

Methods

  • implements js Iterable

    Sealedl

    Returns Iterator<T, any, undefined>

  • Add a new element at the end of the slice and return the new slice

    Parameters

    • Rest ...vals: T[]

    Returns Slice<T>

  • Copy data from src to current slice

    Returns

    How much data was copied

    Parameters

    • src: Iterable<T>

    Returns number

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

    Returns

    whether the element was found

    Parameters

    • callback: ValidCallback<T>

      Determine whether it is the element to be found

    • Optional reverse: boolean

      If true, traverse the container in reverse order

    Returns boolean

  • call callback on each element in the container in turn

    Parameters

    • callback: ValueCallback<T>
    • Optional reverse: boolean

      If true, traverse the container in reverse order

    Returns void

  • Returns the element at index i in the slice

    Throws

    TypeError

    Throws

    RangeError

    Parameters

    • i: number

    Returns T

  • Returns whether the data data exists in the container

    Parameters

    Returns boolean

  • return js iterator

    Parameters

    • Optional reverse: boolean

      If true, returns an iterator to traverse in reverse

    Returns Iterator<T, any, undefined>

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

    Type Parameters

    • TO

    Parameters

    • Optional separator: string

      A string used to separate one element of the container from the next in the resulting string. If omitted, the array elements are separated with a comma.

    • Optional callback: MapCallback<T, TO>
    • Optional reverse: boolean

      If true, traverse the container in reverse order

    Returns string

  • Convert container to array

    Type Parameters

    • TO

    Parameters

    • callback: MapCallback<T, TO>
    • Optional reverse: boolean

      If true, traverse the container in reverse order

    Returns TO[]

  • Sets the element at index i in the slice to val

    Throws

    TypeError

    Throws

    RangeError

    Parameters

    • i: number
    • val: T

    Returns void

  • take sub-slices

    Throws

    TypeError

    Throws

    RangeError

    Parameters

    • Optional start: number
    • Optional end: number

    Returns Slice<T>

  • Creates a slice attached to the incoming array

    Throws

    TypeError

    Throws

    RangeError

    Type Parameters

    • T

    Parameters

    • a: T[]
    • Optional start: number
    • Optional end: number

    Returns Slice<T>

  • Create a slice

    Throws

    TypeError

    Throws

    RangeError

    Type Parameters

    • T

    Parameters

    • length: number
    • Optional capacity: number

    Returns Slice<T>

Generated using TypeDoc