Home > widget-integration > FilterValidationHelper > isPositiveNumber
FilterValidationHelper.isPositiveNumber() method
Validates if a value is a valid positive number.
Checks if the value is a valid number and greater than zero.
Signature:
isPositiveNumber(value: unknown): boolean;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
value |
unknown |
The value to validate. Can be a number or numeric string. |
Returns:
boolean
true if the value is a positive number (> 0), false otherwise
Example
Validate price:
if (this.validationHelper.isPositiveNumber(price)) {
this.calculateTotal(Number(price));
}