static isMaximum()

Checks whether the value of any type is the Maximum instance of any or the given primitive value

Maximum.isMaximum()

Checks whether the value of any type is the Maximum instance of any or the given primitive value.

maximum.class.ts
public static isMaximum<Value extends number>(
  value: any,
  max?: Value
): value is Maximum<Value> {
  return (
    typeof value === 'object' &&
    value instanceof this &&
    (typeof max === 'number' ? value.valueOf() === max : true)
  );
}

Generic type variables

Valueextendsnumber

A generic type variable indicates captured type of the supplied max via the return type.

Parameters

value:any

The value of any type to test against the Maximum instance.

max?:Value

Optional maximum of the generic type variable Value to check if it's the primitive value of the given value.

Return type

value is Maximum<Value>

The return type is a boolean resulting from its statement indicating the value is the Maximum object that takes the generic type variable Value.

Returns

The return value is a boolean indicating whether the provided value is an instance of Maximum.

Example usage

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

Last updated