static isNumber()
Checks the provided value of any type whether is an instance of `Number` of any or the given primitive value
Number.isNumber()
Number.isNumber()The static isNumber() method checks the provided value of any type whether is an instance of Number of any or the given primitive value.
public static isNumber<Value extends number>(
value: any,
numberValue?: Value
): value is Number<Value> {
return (
typeof value === 'object' &&
value instanceof this &&
(typeof numberValue === 'number' ? value.valueOf() === numberValue : true)
);
}Generic type variables
A generic type variable indicates captured type of the supplied numberValue via the return type.
Parameters
The value of any type to test against the Number instance.
Optional number of the generic type variable Value to check if it's the primitive value of the given value.
Return type
The return type is a boolean resulting from its statement indicating the value is the Number object that takes the generic type variable Value.
Returns
The return value is a boolean indicating whether the provided value is an instance of Number of any or the given numberValue.
Example usage
// Example usage.
import { Number } from '@angular-package/range';
Last updated
Was this helpful?