Home > widget-integration > FilterValidationHelper > isInteger

FilterValidationHelper.isInteger() method

Validates if a value is a valid integer.

Accepts both number types and numeric strings. Rejects decimals.

Signature:

isInteger(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 whole number (integer), false otherwise

Example

Validate quantity:

if (this.validationHelper.isInteger(quantity)) {
  this.updateQuantity(Number(quantity));
}