Home Manual Reference Source

Function

Static Public Summary
public

* backwardRangeIterator(start: number, stop: number, step: number): IterableIterator<number>

Yields values in a range, separated by a fixed negative constant called step.

public

* forwardRangeIterator(start: number, stop: number, step: number): IterableIterator<number>

Yields values in a range, separated by a fixed positive constant called step.

public

range(start: number, stop: number, step: number): ForwardRange | BackwardRange

Constructs a Range whose iterator yields values in an interval, separated by a fixed constant called step.

public

rangeArgs(start: number, stop: number, step: number): [number, number, number]

Resolve arguments for range and rangeIterator.

public

rangeIterator(start: number, stop: number, step: number): IterableIterator<number>

Yields values in a range, separated by a fixed constant called step.

Static Public

public * backwardRangeIterator(start: number, stop: number, step: number): IterableIterator<number> source

import backwardRangeIterator from '@iterable-iterator/range/src/backwardRangeIterator.js'

Yields values in a range, separated by a fixed negative constant called step. The range has to be given in reverse order, that is, largest value first, smallest value second. This is an iterator that preserves state accross calls.

Params:

NameTypeAttributeDescription
start number

The starting value.

stop number

The stopping value.

step number

The step value (<0).

Return:

IterableIterator<number>

public * forwardRangeIterator(start: number, stop: number, step: number): IterableIterator<number> source

import forwardRangeIterator from '@iterable-iterator/range/src/forwardRangeIterator.js'

Yields values in a range, separated by a fixed positive constant called step. This is an iterator that preserves state accross calls.

Params:

NameTypeAttributeDescription
start number

The starting value.

stop number

The stopping value.

step number

The step value (>0).

Return:

IterableIterator<number>

public range(start: number, stop: number, step: number): ForwardRange | BackwardRange source

Constructs a Range whose iterator yields values in an interval, separated by a fixed constant called step. If this step is negative, the range has to be given in reverse order, that is, largest value first, smallest value second. Both the starting value and the step value are optional. By default the starting value is 0. The default for the step value is 1.

Params:

NameTypeAttributeDescription
start number
  • optional
  • default: 0

The starting value.

stop number

The stopping value.

step number
  • optional
  • default: 1

The step value.

public rangeArgs(start: number, stop: number, step: number): [number, number, number] source

Resolve arguments for range and rangeIterator.

Params:

NameTypeAttributeDescription
start number
  • optional
  • default: 0

The starting value.

stop number

The stopping value.

step number
  • optional
  • default: 1

The step value.

Return:

[number, number, number]

public rangeIterator(start: number, stop: number, step: number): IterableIterator<number> source

Yields values in a range, separated by a fixed constant called step. If this step is negative, the range has to be given in reverse order, that is, largest value first, smallest value second. Both the starting value and the step value are optional. By default the starting value is 0. The default for the step value is 1.

Params:

NameTypeAttributeDescription
start number
  • optional
  • default: 0

The starting value.

stop number

The stopping value.

step number
  • optional
  • default: 1

The step value.

Return:

IterableIterator<number>