isBetweenEvery()

Checks whether the range of a specified `Range` object is between every range of the given `ranges`

Range.prototype.isBetweenEvery()

Checks whether the range of a specified Range object is between every range of the given ranges.

range.class.ts
public isBetweenEvery(...ranges: [number, number][]): boolean {
  return ranges.every((range) =>
    range[0] <= range[1] ? this.hasEvery(...range) : false
  );
}

Parameters

...ranges: [number,number][]

A rest parameter of ranges of an array type to test.

Return type

Returns

The return value is a boolean type indicating whether the range of a specified Range object is between every range of the given ranges.

Example usage

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

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

// Returns false.
range.isBetweenEvery([3, 26], [4, 27], [5, 28]);

// Returns true.
range.isBetweenEvery([4, 27], [5, 26], [6, 25]);

Last updated