valueDown()

Increments the range value of a specified `Range` object by the range step or given decrement

Range.prototype.valueDown()

The valueDown() method decrements the range value of a specified Range object by the range step or given stepDecrement.

range.class.ts
public valueDown(stepDecrement = 1): this {
  typeof this.value === 'number' &&
    stepDecrement > 0 &&
    this.setValue(this.value - stepDecrement * this.#step);
  return this;
}

Parameters

stepDecrement:number

The optional stepDecrement parameter of the number type decrements the range value. If no parameter is passed, stepDecrement defaults to 1.

Return type

Returns

The return value is the Range instance.

Example usage

// Example usage.
import { Range } 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 10.
range.value;

// Returns 7.
range.valueDown().value;

// Returns 4.
range.valueDown(1).value;

Last updated