getCurrentStep()

Returns the step of the range value

Range.prototype.getCurrentStep()

The getCurrentStep() method returns the step of the range value.

range.class.ts
public getCurrentStep(): number | undefined {
  return typeof this.value === 'number'
    ? Math.floor(this.value / this.#step)
    : undefined;
}

Return type

Returns

The return value is the step of number type, if range 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);

// Returns 3 of number | undefined.
range.getCurrentStep();

Last updated