⚠ valueOf()

Returns a read-only object consisting of the primitive values of `Minimum` and `Maximum` instances

Range.prototype.valueOf()

Deprecated: This feature is no longer recommended. Avoid using it, and update existing code if possible. Be aware that this feature may cease to work at any time.

The valueOf() method returns a read-only object consisting of the primitive values of Minimum and Maximum instances.

range.class.ts
public valueOf(): Readonly<{ min: Min; max: Max }> {
  return Object.freeze({
    min: this.#minimum.valueOf(),
    max: this.#maximum.valueOf(),
  });
}

Return type

Readonly<{ min:Min; max:Max; }>

The return type is the Readonly object consisting of property min of a generic type variable Min and a max of generic type variable Max.

Returns

The return value is a frozen object consisting of the primitive values of Minimum and Maximum instances.

Example usage

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

// Create new instance.
const range = new Range(4, 27);

// Returns Readonly<{ min: 4; max: 27; }>
range.valueOf();

Last updated