Home > widget-integration > FilterValidationHelper > isEmpty

FilterValidationHelper.isEmpty() method

Validates if a string is empty or only contains whitespace.

Handles multiple types: null/undefined, strings, arrays, and objects. Strings are considered empty if they contain only whitespace.

Signature:

isEmpty(value: unknown): boolean;

Parameters

Parameter

Type

Description

value

unknown

The value to check. Can be any type.

Returns:

boolean

true if the value is empty, whitespace-only, null, undefined, an empty array, or an empty object, false otherwise

Example

Validate required fields:

if (this.validationHelper.isEmpty(searchQuery)) {
  this.showError('Search query is required');
  return;
}