isBetween()

Checks whether range of the given `min` and `max` is between the range of a specified `Range` object

Range.prototype.isBetween()

The isBetween() method checks whether range of the given min and max is between the range of a specified Range object.

range.class.ts
public isBetween(min: number, max: number): boolean {
  return min <= max ? this.hasEvery(min, max) : false;
}

Parameters

min:number

The minimum range of number type to test.

max:number

The maximum range of number type to test.

Return type

Returns

The return value is a boolean type indicating whether the range of a specified Range object is between a range of the given min and max.

Example usage

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

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

// Returns false.
range.isBetween(3, 26);

// Returns true.
range.isBetween(4, 27);

// Returns false.
range.isBetween(5, 28);

Last updated