hasEvery()

Checks whether every value of the given values is in the range of a specified `Range` object

Range.prototype.hasEvery()

The hasEvery() method checks whether every value of the given values is in the range of a specified Range object.

range.class.ts
public hasEvery(...values: number[]): boolean {
  return values.every((value) => this.has(value));
}

Parameters

...values:number[]

A rest parameter of numbers to test.

Return type

Returns

The return value is a boolean indicating whether every value of the given values is in the range of a specified Range object.

Example usage

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

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

// Returns false.
range.hasEvery(1, 2, 3);

// Returns true.
range.hasEvery(4, 5, 6);

// Returns true.
range.hasEvery(24, 25, 26);

// Returns false.
range.hasEvery(27, 28, 29);

Last updated