value()?

The `value` accessor indicates the range current value of the number type of a specified `Range` object

Range.prototype.value

The value accessor indicates the range current value of the number type of a specified Range object.

get

The get accessor retrieves the #value property that indicates the range current value of the number type of a specified Range object. It can be set by the setValue() method.

range.class.ts
public get value(): number | undefined {
  return this.#value;
}

set

The set accessor sets the range current value of the number type between the minimum and maximum of a specified Range object.

range.class.ts
public set value(value: number | undefined) {
  typeof value === 'number'
    ? this.has(value) && (this.#value = value)
    : undefined;
}

Type

Example usage

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

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

// Returns 11 of type number | undefined.
range.value;

// Sets below minimum.
range.value = -28;

// Returns 11. Nothing was changed.
range.value;

// Sets above maximum.
range.value = 28;

// Returns 11. Nothing was changed.
range.value;

Last updated