getCurrentRange()

Returns a range of numbers from minimum to the current value by the step of a specified `Range` object

Range.prototype.getCurrentRange()

The getCurrentRange() method returns a range of numbers from minimum to the current value by the step of a specified Range object.

range.class.ts
public getCurrentRange(): Readonly<Array<number>> | undefined {
  return typeof this.value === 'number'
    ? this.getRange(this.value)
    : undefined;
}

Return type

Returns

The return value is a range of numbers of a read-only Array from minimum to the current value, if the current value is set, otherwise undefined.

Example usage

// Example usage.
import { Method } from '@angular-package/range';

// Create new instance.
// Returns Range {min: 3, max: 27, value: 10} of Range<3, 27, 3>.
const range = new Range(3, 27, 10, 3);

// Get entire range.
// Returns (9) [3, 6, 9, 12, 15, 18, 21, 24, 27]
range.range;

// Returns (3) [3, 6, 9]
range.getCurrentRange();

Last updated