Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RangeDefinition

Class that stores and manipulates the data for the range iterator.

Hierarchy

  • RangeDefinition

Index

Constructors

constructor

  • new RangeDefinition(first: number, second?: undefined | number, step?: number): RangeDefinition
  • Parameters

    • first: number

      Either the start or end. It's the end if second is undefined otherwise it is the start.

    • Optional second: undefined | number

      The end of the range.

    • Default value step: number = 1

      The step property. Defaults to 1.

    Returns RangeDefinition

Properties

Private end

end: Big | number

The end of the range. This is exclusive so the range will only include up to this number but not this number itself.

Private start

start: Big | number

The start of the range.

Private step

step: Big | number

The size of the steps to take until you hit the end.

Methods

Private convertToJSNumber

  • convertToJSNumber(num: Big | number): number
  • Parameters

    • num: Big | number

      The number to convert to a JS number.

    Returns number

    num as a JS number.

createRange

  • createRange(): IterableIterator<number>
  • Takes all the data this class hold and makes an iterator.

    Returns IterableIterator<number>

    The range iterator.

Private getStepAfter

  • getStepAfter(current: Big | number): number | Big
  • Parameters

    • current: Big | number

      The number to add step to.

    Returns number | Big

    The next value in the range after current.

Private isInRange

  • isInRange(current: Big | number): boolean
  • Mainly used for comparing the current count in the generator to end.

    Parameters

    • current: Big | number

      The number to compare to end

    Returns boolean

    Whether current is in range.

Generated using TypeDoc