isBetweenSome()

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

Range.prototype.isBetweenSome()

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

range.class.ts
public isBetweenSome(...ranges: [number, number][]): boolean {
  return ranges.some((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 some given ranges.

Example usage

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

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

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

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

Last updated