Overview

The `Range` object

Range {}

The Range object represents a range between a minimum and maximum.

range.class.ts

Accessors

public get range(): Readonly<Array<number>> The get accessor obtains the range of an Array of the minimum to the maximum with the step of a specified Range object.

public get step(): Step The get accessor obtains the step of a specified Range object.

public get steps(): number Retrieves the number of steps of the specified Range object.

public value(): number | undefined The value accessor indicates the range current value of the number type of a specified Range object.

public get [Symbol.toStringTag](): string The get accessor, with the help of toStringTag, changes the default tag to 'Range' for an instance of Range.

Properties

public readonly max!: Max The max read-only property is the maximum range of generic type variable Max of a specified Range object.

public readonly min!: Min; The min read-only property is the minimum range of generic type variable Min of a specified Range object.

#maximum: Maximum<Max> Private property of the Maximum primitive wrapper object with a primitive value from a given max of the Range constructor indicates the maximum range.

#minimum: Minimum<Min> Private property of the Minimum primitive wrapper object with a primitive value from a given min of the Range constructor indicates the minimum range.

#step: Step The private property of the generic type variable Step indicates the range step.

#value?: number The private property of the number type indicates the range value.

Methods

public static create(): Range<Value> Returns a new instance of Range with a range of the given required min, max and optional current value, step.

public static createFrom(): Range<number, number, Step> Creates the Range instance from the given random numbers and the step.

public static createMaximum(): Maximum<Value> Returns the Maximum instance of the given maximum value.

public static createMinimum(): Minimum<Value> Returns the Minimum instance of the given minimum value.

public static isRange(): value is Range<Min, Max> Checks whether the value is an instance of Range of any or the given minimum and maximum range and step.

public forEachStep(): this Performs the specified action for each step in the maximum range of an Array.

public getCurrentRange(): Readonly<Array<number>> | undefined Returns a range of numbers from minimum to the current value by the step of a specified Range object.

public getCurrentStep(): number | undefined Returns the step of the range value.

public getMax(): Max Gets the maximum range of a specified Range object.

public getMin(): Min Gets the minimum range of a specified Range object.

public getRange(): number[] Returns range of numbers from minimum to the given value with the step of a specified Range object.

public getRangeOfStep(): Readonly<Array<number>> | undefined Returns a range of numbers by the specified step from the minimum to the given step of a specified Range object.

public getValueOfStep(): number | undefined Returns the range value of the given step.

public has(): boolean Checks whether the value is in the range of a specified Range object.

public hasEvery(): boolean Checks whether every value of the given values is in the range of a specified Range object.

public hasSome(): boolean Checks whether some values are in the range of a specified Range object.

public isBetween(): boolean Checks whether range of the given min and max is between the range of a specified Range object.

public isBetweenEvery(): boolean Checks whether the range of a specified Range object is between every range of the given ranges.

public isBetweenSome(): boolean Checks whether the range of a specified Range object is between some given ranges.

public maxGreaterThan(): boolean Checks whether the value is less than the maximum range of a specified Range object.

public maxLessThan(): boolean Checks whether the value is greater than the maximum range of a specified Range object.

public minGreaterThan(): boolean Checks whether the value is less than a minimum range of a specified Range object.

public minLessThan(): boolean Checks whether the value is greater than the minimum range of a specified Range object.

public setValue(): this Sets the range value between the minimum and maximum of a specified Range object.

public setValueToStep(): this Sets the value of the specified Range object to the value of the given step.

public stepByStep(): this Performs a callback function with the ability to decide when to move to the next step of the range.

public toArray(): readonly [Min, Max] Returns a read-only array of the range in order minimum and maximum.

public valueOf(): Readonly<{ min: Min; max: Max }> Returns a read-only object consisting of the primitive values of Minimum and Maximum instances.

Last updated