Skip to content

Function: isEmpty()

ts
function isEmpty(value: any): boolean;

Defined in: src/utils/isEmpty.ts:19

Check if a value is empty. A value is considered empty if it is:

  • null or undefined
  • A string or array with a length of 0
  • A Map or Set with a size of 0
  • An object with a length property that is 0
  • A plain object with no own enumerable properties

Parameters

ParameterTypeDescription
valueanyThe value to check.

Returns

boolean

true if the value is empty, otherwise false.

Example

ts
const cart = [];
isEmpty(cart); // true
isEmpty({ item: 'coffee' }); // false

Matterway Assistant SDK Documentation