valueUp()

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

Range.prototype.valueUp()

The valueUp() method increments the range value of a specified Range object by the range step or given stepIncrement.

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

Parameters

stepIncrement:number

The optional stepIncrement parameter of the number type increments the range value. If no parameter is passed, stepIncrement 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 13.
range.valueUp().value;

// Returns 19.
range.valueUp(2).value;

Last updated