Class: SliceLens

SliceLens

new SliceLens(i, j) → {SliceLens}

A SliceLens focuses on a slice of an array from starting and ending indices. SliceLenses can be constructed in two ways:

  1. By giving it integer start and end indices, which can be negative (negative indices start from the right)
  2. By passing in a Python-style string representing the slice, e.g. '0:-1'. By default, the starting index is set to 0 and the ending index is set to arr.length, so for instance, new SliceLens(':') focuses on the whole list.
Parameters:
Name Type Description
i int | string

The start of the slice or a string representing the slice, e.g. '0:-1"

j int

The end of the Slice

Returns:
Type
SliceLens